开发者

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

开发者 https://www.devze.com 2023-03-02 04:51 出处:网络
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 v开发者_如何学编程ia a REST API on GAE.

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 v开发者_如何学编程ia 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!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号