Make OAuth scope configurable for GoogleDrive.

This commit is contained in:
Magnus Gille
2016-01-02 20:42:20 -05:00
parent 4713a5dc19
commit 95d7f51077
5 changed files with 64 additions and 19 deletions

View File

@@ -133,10 +133,14 @@ OAuthDialog::OAuthDialog(Context *context, OAuthSite site) :
urlstr.append("response_type=code&");
urlstr.append("client_id=").append(GC_GOOGLE_CALENDAR_CLIENT_ID);
} else if (site == GOOGLE_DRIVE) {
const QString scope =
appsettings->cvalue(
context->athlete->cyclist,
GC_GOOGLE_DRIVE_AUTH_SCOPE, "drive.appdata").toString();
// OAUTH 2.0 - Google flow for installed applications
urlstr = QString("https://accounts.google.com/o/oauth2/auth?");
// We only request access to the application data folder, not all files.
urlstr.append("scope=https://www.googleapis.com/auth/drive.appdata&");
urlstr.append("scope=https://www.googleapis.com/auth/" + scope + "&");
urlstr.append("redirect_uri=urn:ietf:wg:oauth:2.0:oob&");
urlstr.append("response_type=code&");
urlstr.append("client_id=").append(GC_GOOGLE_DRIVE_CLIENT_ID);