RunOrVeith opened a new issue, #1806: URL: https://github.com/apache/libcloud/issues/1806
## Summary You can no longer sign into the google driver using a OAuth2 Desktop Client, [since out-of-band authentication is deprecated and has been removed in October. ](https://developers.google.com/identity/protocols/oauth2/resources/oob-migration) ## Detailed Information Code to reproduce (you need an OAuth2 Client Id with Desktop type) ```python from libcloud.storage.providers import get_driver if __name__ == '__main__': driver_type = get_driver("google_storage") driver_type(key="YOUR CLIENT ID", secret="YOUR CLIENT SECRET") ``` This will now display an URL for you do click on and sign in, where you used to receive a code to copy-paste and would then proceed to be logged in. Now, you just get a window that your request is invalid. The issue is in `libcloud.common.google.GoogleInstalledAppAuthConnection.get_code` (line 423 in libcloud 3.6.1). There, the redirect url is set to self.redirect_url, which can not be changed and is currently the default value defined in `libcloud.common.google.GoogleBaseAuthConnection.__init__`: `"urn:ietf:wg:oauth:2.0:oob"`, which is used for the out-of-band authentication. The new workflow works without copy and pasting if you change the redirect_uri to `"http://127.0.0.1:8087` and then have a local webserver running to receive the redirect. I will post a pull request to fix this as soon as I can. ## Workaround If you can not wait for the release of the new version with this issue fixed, here is a workaround: 1. Go to `libcloud.common.google` and find the method `GoogleInstalledAppConnection.get_code` 2. Within that method, there is a parameter `"redirect_uri": self.redirect_uri,` . Replace that line with `"redirect_uri": "http://127.0.0.1:8087/",` 3. Run the following snippet ```python from libcloud.storage.providers import get_driver if __name__ == '__main__': driver_type = get_driver("google_storage") driver_type(key="YOUR CLIENT ID", secret="YOUR CLIENT SECRET") ``` 4. It will print out an URL. Follow the instructions there. IMPORTANT: before you finish the sign in, you need to open the development console in your browser and go to the network tab 5. Finish sign in. In the network tab you will find a GET request to the domain 127.0.0.1:8087. Click on it, there should be a parameter in the url that reads code=<SOME-LETTERS-AND-NUMBERS> . You need to copy this code (without the code=) 7. On your terminal, make the following request using cURL; don't forget to paste your code in the marked spot! ``` curl -X POST "https://oauth2.googleapis.com/token" --data-urlencode "code=<PASTE YOUR COPIED CODE HERE>" --data-urlencode "client_id=<YOUR CLIENT ID>" --data-urlencode "client_secret=<YOUR CLIENT SECRET>" --data-urlencode "redirect_uri=http://127.0.0.1:8087/" --data-urlencode "grant_type=authorization_code" > $HOME/.google_libcloud_auth.<YOUR CLIENT ID> ``` 8. You should now be able to use your app again since you already have a token and a different execution path is taken. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@libcloud.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org