我可以使用Android的的AccountManager获取OAuth访问令牌的应用引擎?令牌、可以使用、引擎、AccountManager

2023-09-05 02:09:48 作者:农夫三拳

我有Android客户端我的AppEngine上的服务器,都使用谷歌帐户。我想用的AccountManager获取的 accessToken 的对OAuth的。到目前为止,我使用的ClientLogin,但我想切换到OAuth的。

I have Android client to my AppEngine server, both using Google Accounts. I would like to use AccountManager for getting accessToken for OAuth. So far I'm using ClientLogin, but I would like to switch to OAuth.

设置OAuth的上AppEngine上很容易 - 我跟着的这篇文章。但是,客户端是一个谜,尤其是我不知道是干什么用的范围,术语的AccountManager的 authTokenType 的。对于ClientLogin的,我用啊了的 authTokenType 的。但是,我们的OAuth?

Setting up OAuth on AppEngine is easy - I followed this article. But the client side is a mystery, in particular I don't know what to use for scope, in AccountManager terms authTokenType. For ClientLogin, I'm using "ah" for authTokenType. But what about OAuth?

推荐答案

截至今天,你可以使用谷歌播放服务API在Android上做机器人的Oauth 2.0认证。然后,您可以使用由@nivco描述的方法来获得对应用程序引擎的用户信息。我没有这样做,但我打算TP做的正是你在说什么。

As of today you can use Google Play Services API on android to do Oauth 2.0 authentication on android. You could then use the method described by @nivco to get the userinfo on appengine. I have not done this yet, but I plan tp do exactly what your talking about.

https://developers.google.com/android/google-play-services/authentication