【发布时间】:2019-01-21 08:31:45
【问题描述】:
我正在尝试从 Google+ API 获取授权码,如Step 1(Set authorization parameters) (HTTP/REST) 中所述。
正如我在那里读到的,Google 授权服务器具有以下强制性查询字符串参数:client_id、redirect_uri 和 scope,所以我的 href 看起来像这样:
https://accounts.google.com/o/oauth2/v2/auth?client_id=123002756467-dmq0soo7rlfc4on640hdsehnrvb700t7.apps.googleusercontent.com&redirect_uri=http://localhost:5000/oAuthCallback&scope=https://www.googleapis.com/auth/glass.location
尝试访问该链接时,我收到以下错误: 错误:invalid_request(缺少必需参数:response_type)
但是,response_type 参数根本没有在该参数列表中指定!
有什么办法可以解决这个问题吗?
已修复。似乎我的代码编辑器中的空格也作为“%20”插入到我的链接中,所以这就是它不起作用的原因。
【问题讨论】:
-
检查 OAuth2 响应类型:tools.ietf.org/html/rfc6749#section-3.1.1
-
@Edwin,即使在指定了 response_type 参数后,我也会得到同样的错误
-
在第 2 步中,您指定了
response_type+ 其他参数,您尝试过吗? -
response_type=code
标签: javascript oauth authorization google-oauth