【问题标题】:Oauth2 playground - Input of scopes in the "input your scopes" box - how?Oauth2 游乐场 - 在“输入您的范围”框中输入范围 - 如何?
【发布时间】:2020-10-27 04:37:10
【问题描述】:

如何在 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

【问题讨论】:

    标签: scopes oauth2-playground


    【解决方案1】:

    对于 Google,范围通常应该用空格分隔:

    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 使用哑文本字段来指定多个范围。

    【讨论】:

    • 谢谢,这有助于理解问题
    【解决方案2】:

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

    b.我单击链接图标以获取所做选择的链接

    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 密钥。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-01-19
      • 2013-10-26
      • 2021-08-22
      • 1970-01-01
      • 1970-01-01
      • 2013-12-25
      • 1970-01-01
      相关资源
      最近更新 更多