Friday, 15 July 2011

google app engine - OAuth2WebServerFlow works from localhost, but not from real AppEngine Instance -



google app engine - OAuth2WebServerFlow works from localhost, but not from real AppEngine Instance -

i'm using oauth2webserverflow user's sheets credentials utilize gdata/spreadsheets api. i'm having hard time diagnosing problem because works flawlessly when run application locally.

this snippet i'm using authorization url:

client_id = 'my-id' client_secret = 'my-secret' scope = 'https://spreadsheets.google.com/feeds' flow_object = oauth2webserverflow(client_id, client_secret, scope, redirect_uri=self.redirect_url, access_type='online') authorize_url = flow_object.step1_get_authorize_url()

locally (using redirect_url = 'http://localhost:8080/this-path/') produces:

https://accounts.google.com/o/oauth2/auth?redirect_uri=http%3a%2f%2flocalhost%3a8080%2fthis-path%2f&scope=https%3a%2f%2fspreadsheets.google.com%2ffeeds&client_id=my-id&response_type=code&access_type=online

on live app engine application (using redirect_url = 'http://my-app.appspot.com/this-path/') produces:

https://accounts.google.com/o/oauth2/auth?scope=https%3a%2f%2fspreadsheets.google.com%2ffeeds&redirect_uri=http%3a%2f%2fmy-app.appspot.com%2fthis-path%2f&response_type=code&client_id=my-id&access_type=online

the application configuration looks like:

client id: my-id email address: my-id@developer.gserviceaccount.com client secret: my-secret redirect uris: http://localhost:8080/ http://my-app.appspot.com https://my-app.appspot.com http://my-app.appspot.com/this-path https://my-app.appspot.com/this-path http://my-app.appspot.com/this-path/ https://my-app.appspot.com/this-path/ javascript origins http://localhost:8080 http://my-app.appspot.com

going locally generated version of url can grant application permission. @ url generated live application 401 says "error: disabled_client oauth client disabled".

i sense configuration error. maybe fact works locally reddish herring? perhaps able grant localhost these permissions? i'm genuinely out of ideas on , help appreciated.

in application configuration, redirect url should http://localhost:8080/oauth2callback, according understanding oauth2callback authorizes token @ end of flow. refer document [1].

[1] oauth 2.0: https://developers.google.com/api-client-library/python/guide/aaa_oauth#oauth2webserverflow

google-app-engine oauth oauth-2.0 google-oauth gdata

No comments:

Post a Comment