![](/img/trans.png)
[英]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.