-
Notifications
You must be signed in to change notification settings - Fork 11
OAuth flow is currently broken when using a custom Client ID and Client Secret in combination with Limited Drive Access #3
Description
If you enter a custom Client ID and Client Secret in this plugin's configuration menu, tick the box for Limited Drive Access and try to upload a database to Google Drive, KeePass opens a new browser with the custom application's OAuth URL as expected. The problem is that the OAuth URL is invalid because the scope parameter in the API request is blank.
Example URL
https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&login_hint=<GMAIL_ADDRESS>&response_type=code&client_id=<CLIENT_ID>-<CLIENT_SECRET>&redirect_uri=http://localhost:16812/&scope=&state=<STATE>
Solution
The scopes required by the Limited Drive Access feature are https://www.googleapis.com/auth/drive.appdata and https://www.googleapis.com/auth/drive.file. Please note that the Google API requires multiple values to be separated by a single space, like this:
https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&login_hint=<GMAIL_ADDRESS>&response_type=code&client_id=<CLIENT_ID>-<CLIENT_SECRET>&redirect_uri=http://localhost:16812/&scope=https://www.googleapis.com/auth/drive.appdata https://www.googleapis.com/auth/drive.file&state=<STATE>
#OffTopic
Thank you, by the way, for reviving this wonderful plugin! I've been using the original SourceForce version since 2017 and have been dreading the day Google makes an API change that renders it non-functional. That hasn't happened yet, but knowing that there is an actively maintained fork puts my mind at ease.
I switched over to your version earlier today and apart from the little hiccup that this bug is about (which was easily resolvable by making those changes to the OAuth URL manually), I quite like the improvements you've made to it so far. I also recently created a fork of an abandoned KeePass plugin, if you're interested: https://github.com/whalehub/CustomGlobalHotkeys
