
[英]On Google App Engine, can I relate a Google OAuth 2 Token and a SACSID token I got using Android's AccountManager?
[英]Can I use Android's AccountManager for getting OAuth access token for AppEngine?
我有Android客户端到我的AppEngine服务器,都使用Google帐户。 我想使用AccountManager获取OAuth的accessToken 。 到目前为止,我正在使用ClientLogin,但我想切换到OAuth。
在AppEngine上设置OAuth很简单 - 我遵循了这篇文章 。 但客户端是一个谜,特别是我不知道用于范围的内容,在AccountManager术语authTokenType中 。 对于ClientLogin,我使用“ah”表示authTokenType 。 但OAuth呢?
截至今天,您可以在Android上使用Google Play Services API在Android上进行Oauth 2.0身份验证。 然后,您可以使用@nivco描述的方法获取appengine上的userinfo。 我还没有这样做,但我计划完全按照你的说法去做。
https://developers.google.com/android/google-play-services/authentication
我不确定您要通过您所指的文章中使用的App Engine OAuthService来做什么。 另外,据说AppEngine OAuthService仅支持OAuth 1,但Android仅支持OAuth 2 :)所以你搞砸了。
如果你想跨Android - App Engine身份验证,我会做的是:
https://www.googleapis.com/auth/userinfo.email
和https://www.googleapis.com/auth/userinfo.profile
)。 PS:我在本文中描述了使用Android AccountManager获取OAuth 2令牌。 它写在冰淇淋三明治之前,但我跳的它仍然有效。 基本上authTokenType
需要是oauth2:{scopes}
,因此例如oauth2:https://www.googleapis.com/auth/tasks
用于任务API。 现在可能有更好的方法可以做到这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.