从Google API获取刷新令牌 [英] Getting a refresh token from google api

查看:808
本文介绍了从Google API获取刷新令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我浏览了其他帖子,但未得到答复(已停止从Google的API获取刷新令牌),或者似乎不再纠正。

I've looked through other posts and they're either unanswered (Stopped getting refresh token from google's API) or no longer correct it seems.

我正在尝试从Google api获取新的刷新令牌,我具有access_type ='offline'和rovaling_prompt ='force',但我返回的响应不包含刷新令牌。我浏览过的其他帖子说,拥有这两个参数应该会给我返回刷新令牌。

I am trying to get a new refresh token from the google api, I have access_type = 'offline' and approval_prompt = 'force' but the response I'm getting back does not contain a refresh token. The other posts I have looked through says that having those two parameters should return me a refresh token.

有任何想法吗?

编辑:我在想也许我可以撤消auth并让用户重新进行身份验证以获取新的refresh_token。会行得通吗/是否有更好的解决方案?

I was thinking perhaps I could revoke the auth and have the user re-auth to get a fresh refresh_token. Would this work/is there a better solution?

推荐答案

我想我已经解决了,而不是使用rovaling_prompt = force,您可以使用:

I think I figured it out, instead of using approval_prompt=force you can use:

{       
        ...
        access_type='offline',
        prompt='select_account consent'
}

强制执行新的批准屏幕并获取新的刷新令牌

to force a new approval screen and get a new refresh token.

这篇关于从Google API获取刷新令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆