简体   繁体   English

无法通过Google OAuth2获取刷新令牌

[英]Not getting refresh token with google oauth2

I have the set the scope to ' https://mail.google.com/ ' and the extra params like 'access-type=offline' and 'approval-prompt=force' are also set. 我将范围设置为“ https://mail.google.com/ ”,还设置了诸如“ access-type = offline”和“ approval-prompt = force”之类的额外参数。

After the process is complete, I'm not getting the refresh token. 该过程完成后,我没有得到刷新令牌。 I only get the access_token, expires_in and token_type fields. 我只得到access_token,expires_in和token_type字段。

I even revoked the access to the app from the account I used to test and tried multiple times. 我什至取消了我以前测试过的帐户对应用程序的访问权限,并尝试了多次。 Still got the same result. 仍然得到相同的结果。

The syntax of the parameters must use underscores as a separator instead of the hyphens you use, so use access_type=offline and approval_prompt=force . 参数的语法必须使用下划线作为分隔符,而不要使用连字符,因此请使用access_type=offlineaccess_type=offline approval_prompt=force

Note that you'll only get a refresh token on the first attempt to connect an application or after revoking access as you already seem to suggest. 请注意,按照您似乎已经建议的那样,在首次尝试连接应用程序时或在撤消访问权限后,您只会获得刷新令牌。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM