android - 如何使用 Azure 应用服务让 Google 帐户显示离线范围

标签 android ios azure

我在使用以下博客文章中的信息时遇到问题

https://cgillum.tech/2016/03/07/app-service-token-store/

我有一个可以使用 Windows 或 Google 帐户登录的应用。

使用 Windows 帐户一切都很好。

我能够登录并接收刷新 token 。

这将毫无问题地刷新。

使用 Google 帐户,我不会获得刷新 token ,并且 Google 帐户不会请求我的许可来拥有离线范围。

这是我用来登录的代码:

 return await client.LoginAsync(myView, MobileServiceAuthenticationProvider.Google, new Dictionary<string, string>() {
                { "access_type", "offline" } });

最佳答案

我认为问题可能是什么(来自 Google 的 OAuth documentation):

Important: When your application receives a refresh token, it is important to store that refresh token for future use. If your application loses the refresh token, it will have to re-prompt the user for consent before obtaining another refresh token. If you need to re-prompt the user for consent, include the prompt parameter in the authorization code request, and set the value to consent.

基本上,如果您已经收到特定请求的刷新 token ,听起来 Google 不会给您新的 token ,除非您明确提示用户同意离线范围。您可以通过在登录中添加 prompt=consent 查询字符串参数来完成此操作。例如:

/.auth/login/google?access_type=offline&prompt=consent

我见过其他人也这么做过。尝试一下,看看是否也能解决您的问题。

关于android - 如何使用 Azure 应用服务让 Google 帐户显示离线范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36305826/

相关文章:

azure - GitHub 推送到 Azure 网站

android - 从日期选择器 onDateSet 获取长时间戳

android - 如何在android中不使用参数传递值

ios - Facebook iOS SDK 和基于 Safari 的身份验证问题

azure - 无法更新 azure Linux 虚拟机中的 ssh key

azure - 在 Powershell 中创建 Azure API 管理标签

java - 尝试测试 2 个 JSON 框架的性能 - 它看起来正确吗?

android - 在android中禁用菜单项的背景高亮颜色

ipad - UIPopoverController & UIImagePickerControl : "Popovers cannot be presented from a view which does not have a window"

ios - UIAlertView 索引按钮