【发布时间】:2012-01-24 20:48:05
【问题描述】:
如何验证从
返回的 auth_tokentoken = bundle.getString(AccountManager.KEY_AUTHTOKEN);
?
在 Android 上获得新用户后,我需要将它们插入到我的数据库服务器端,但我需要先以某种方式验证该令牌。
我正在尝试像这样使用令牌:
url = 'https://www.googleapis.com/oauth2/v1/userinfo?access_token=%s' % access_token
但 Google 正在返回“未经授权的访问”。
如何访问
https://www.googleapis.com/oauth2/v1/userinfo
使用 Android AccountManager 提供的“auth_token”?
【问题讨论】:
-
我不确定你是否可以将该令牌用于 Android 以外的其他服务,不过我可能是错的。
-
我认为您缺少 'oauth2:' 范围前缀。请参阅下面的答案。
标签: android google-api oauth-2.0