0

如何在 oauth2 Playground UI 的输入范围框中输入多个范围?我正在尝试使用此链接生成身份验证/刷新令牌:https ://developers.google.com/oauthplayground

我在选择 API 范围时找不到我需要的范围: https://www.googleapis.com/auth/script.external_request https://www.googleapis.com/auth/script.send_mail

因此,我试图将其包含在“输入您的范围框”中。我可以包括其中之一,但只能在框中输入一个范围。我如何将两者都包括在内?

我尝试了以下但没有成功 https://www.googleapis.com/auth/script.external_request,https://www.googleapis.com/auth/script.send_mail

https://www.googleapis.com/auth/script.external_request;https://www.googleapis.com/auth/script.send_mail

"https://www.googleapis.com/auth/script.external_request","https://www.googleapis.com/auth/script.send_mail"

https://www.googleapis.com/auth/script.external_request + https://www.googleapis.com/auth/script.send_mail

4

2 回答 2

1

通常对于谷歌来说,范围应该用空格分隔:

https://www.googleapis.com/auth/script.external_request https://www.googleapis.com/auth/script.send_mail

Facebook 使用逗号,Instagram 使用加号……这里列出了一些示例:https ://brandur.org/oauth-scope#google

不幸的是,OAuth 2.0 规范没有明确定义多范围,因此 OAuth 提供者使用了不同的分隔符,因此 OAuth Playground 使用哑文本字段来指定多个范围。

于 2020-10-27T23:41:57.837 回答
0

我解决了这个问题如下:我在此处的 OAuth 操场上进行了选择,添加了客户端 ID、密码等:https ://developers.google.com/oauthplayground/

湾。我单击了链接图标以获取所做选择的链接 获取网址的链接

C。然后我编辑了 URL 以包含我想要的范围,如下所示(以粗体显示):

https://developers.google.com/oauthplayground/#step1&apisSelect= https%3A%2F%2Fmail.google.com%2F%2C https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fscript.send_mail%2C https %3A%2F%2Fwww.googleapis.com%2Fauth%2Fscript.external_request &url=myurl&content_type=application%2Fjson&http_method=POST&useDefaultOauthCred=checked&oauthEndpointSelect=Google&oauthAuthEndpointValue=somevalue&oauthTokenEndpointValue=somevalue&oauthClientId=myClientId&oauthClientSecret=mySecret&accessTokenType=bearer...

d。最后,我将此 URL 粘贴到浏览器中,授权 API 并继续获取 Auth 密钥。

于 2020-10-29T10:54:35.043 回答