我在Android上使用Google Play服务来访问Google API和Google Cloud Endpoints。我也可以使用来自Google Play服务的令牌来访问appengine用户API。这可能吗?在此链接中有一些OAuth示例代码,但是有点含糊不清。我能否将OAuth令牌传递到标头中并使用下面的代码获取用户?
User user = null;
try {
OAuthService oauth = OAuthServiceFactory.getOAuthService();
user = oauth.getCurrentUser();
} catch (OAuthRequestException e) {
// The consumer made an invalid OAuth request, used an access token that was
// revoked, or did not provide OAuth information.
// ...
}