Google Drive OAuth 2 flow giving invalid_scope error -


my google drive app requests following scopes when exchanging code access token:

https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/drive.install 

in particular, query string of url being requested google during exchange:

code=xxxxxxxxxx&grant_type=authorization_code&redirect_uri=xxxxxxxxxxx& scope=https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive.file+ https%3a%2f%2fwww.googleapis.com%2fauth%2fuserinfo.email +https%3a%2f%2fwww.googleapis.com%2fauth%2fuserinfo.profile +https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive.install &client_id=xxxxxx.apps.googleusercontent.com&client_secret=xxxxxx

the response 400 error, error message "invalid_scope". doing wrong?

[edit] additional information:

the error happens when user clicks through google drive create new document. if initiate authentication/authorization flow own app, list of scopes accepted fine. if user clicks through actual drive app create new document, invalid_scopes.

the invalid scope drive.install. if remove list of requested scopes when user shows create new document, things start working again. make sense @ all? if user has drive app installed via requesting scope, why requesting same scope when user shows drive app cause problem of kind?

i experienced similar problem. solution pass array of scopes google client:

google_client.authorization.scope=[ 'https://www.googleapis.com/auth/calendar.readonly', 'https://www.googleapis.com/auth/drive.appdata']  

rather concatenated string of scopes

google_client.authorization.scope="https://www.googleapis.com/auth/calendar.readonly%2bhttps://www.googleapis.com/auth/drive.appdata"  

the request in rails log looked identical, result different!


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -