In my experience, Google's oauth related documentation is very confusing. I have a Phonegap (i.e. Javascript) application that authenticates with my app engine app using OAuth2, and I used to run around in circles in the docs trying to figure out how to do OAuth2.
I use "https://www.googleapis.com/auth/userinfo.email" as the scope, and "https://accounts.google.com/o/oauth2/auth" "https://accounts.google.com/o/oauth2/token" as the endpoints. The access token is inserted in the authentication headers. The app engine side looks up user identity like this: user = oauth.get_current_user('https://www.googleapis.com/auth/userinfo.email') Feel free to ask for more details if you need. Pertti On Tue, Nov 12, 2013 at 3:09 AM, Derek Battams <[email protected]> wrote: > I'm having a hard time finding a definitive answer to this question: > > Within my appengine app, can the use of oauth.get_current_user() ever return > a user object if using Google's oauth2 end points as the authentication > method? > > The get_current_user() call works fine and returns the User object when > expected if I use my app's end points to get oauth tokens > (myappid.appspot.com/_ah/OAuth*). But this is using OAuth 1.0, which the > Google dev docs are clear to point out is deprecated. > > So then I tried to use the OAuth2 end points and I've registered the app, > got my client_id, etc. I've authorized my command line app to access the > scope https://www.googleapis.com/auth/appengine.admin and I've sent the > request to my app, but the oauth.get_current_user() call always throws an > oauth.OAuthRequestError > > So the question is, am I doing something wrong with OAuth2 (wrong scope, > etc.) or is the only way the get_current_user() method works is via OAuth1 > to your app's end points? > > Help appreciated. > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/google-appengine. > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/groups/opt_out.
