accountmanager 刷新令牌(离线访问) [英] accountmanager refresh token(offline access)
问题描述
我在我的 android 应用程序中通过帐户管理器使用谷歌登录.我可以获得发送到服务器的访问令牌,服务器可以创建/登录新用户.Accesstoken 的有效期只有 3600 秒.问题是服务器无法在此时间到期后更新用户信息.网络应用需要定期检查用户信息.
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帐户管理器获取身份验证令牌和刷新令牌,以便服务器可以使用刷新令牌定期更新数据?我不想在 android 应用程序中通过 webview 使用登录.
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
您请求一次性授权码,将其发送到您的服务器,然后您的服务器将其交换为访问令牌和刷新令牌.
You request a one-time authorisation code, send it to your server and your server exchanges it for an access token and refresh token.
这篇关于accountmanager 刷新令牌(离线访问)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!