的AccountManager刷新令牌(离线访问)离线、令牌、AccountManager

由网友(凉不过人心)分享简介:我在我的Andr​​oid应用程序使用谷歌登录,通过客户经理。我可以得到accesstoken我发送给服务器和服务器可以创建/登入新用户。 Accesstoken只适用3600秒。问题是,这个时间到期后,服务器无法更新用户的信息。 Web应用,需要检查用户的信息定期。I use google login throug...

我在我的Andr​​oid应用程序使用谷歌登录,通过客户经理。我可以得到accesstoken我发送给服务器和服务器可以创建/登入新用户。 Accesstoken只适用3600秒。问题是,这个时间到期后,服务器无法更新用户的信息。 Web应用,需要检查用户的信息定期。

I use google login through account manager in my android app. I can get accesstoken which I send to server and server can create/login new user. Accesstoken is valid only 3600seconds. Problem is that server can not update user's info after this time expires. Web app requires check user's info periodically.

如何我可以从Android的客户经理,因此比服务器可以使用刷新标记定期更新数据认证令牌,令牌刷新?我不通过的WebView在Android应用程序要使用的登录。

How can I get authentication token and refresh token from android account manager so than server can use refresh token to update data periodically? I don't want use login through webview in android app.

感谢

推荐答案

这是现在可以:的https://developers.google.com/+/mobile/android/sign-in#server-side_access_for_your_app

您申请一次性授权code,将其发送到您的服务器和服务器交换它的访问令牌,并刷新令牌。

You request a one-time authorisation code, send it to your server and your server exchanges it for an access token and refresh token.

阅读全文

相关推荐

最新文章