Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Google Users API with Google App Engine and Android

Server is on Google App Engine, and the client is an Android mobile app. I want to use the Users API to log users in from Android via a REST API on GAE.

In the Users API documentation it looks like the key (to construct a User object on the server) is the email. But I'm told there's a way to get the User Object via and oauth token. Meaning you'd call users.get_current_user() and the token would be used automatically to fetch that User Object.

Questions:

1 - Are there any examples of this process (code) available? 2 - Where does the Users API expect to find the oath token? As a request parameter? Is the token injested automatically at the time get_current_user() is called?

Thanks!

like image 706
Will Curran Avatar asked Feb 03 '26 20:02

Will Curran


1 Answers

From the OAuth API docs:

from google.appengine.api import oauth

user = oauth.get_current_user()

With a valid OAuth request, this will return a db.User object just like users.get_current_user().

OAuth endpoint URLs for your app are detailed on the same page.

like image 199
Drew Sears Avatar answered Feb 06 '26 09:02

Drew Sears



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!