Oauth2游乐场-在“输入您的范围”框中输入范围-怎么样?

问题描述

如何在oauth2操场用户界面的“范围”输入框中输入多个范围? 我正在尝试使用以下链接生成身份验证/刷新令牌: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

解决方法

通常对于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使用了一个哑文本字段来指定多个范围。

,

我解决了以下问题: 一种。我的选择是在以下https://developers.google.com/oauthplayground/

的OAuth操场上添加了客户端ID,机密等

b。我单击链接图标以获取所做选择的链接 Link to get Url

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

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...