javascript - 授权代码请求时 Google OAuth2 response_type 错误

标签 javascript oauth authorization google-oauth

我正在尝试从 Google+ API 获取授权代码,如 Step 1(Set authorization parameters) 中所述。 (HTTP/REST)。

据我所知,Google 授权服务器具有以下强制查询字符串参数:client_idredirect_uriscope,因此我的 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 参数根本没有在该参数列表中指定!

有什么想法可以解决这个问题吗?

Fixed. It seems that the spaces in my code editor were also inserted in my link as "%20", so that's why it didn't work.

最佳答案

由于您遵循服务器文档,response_type=code 参数将出现在下一步 [1] 的示例授权请求 URL 中。

您可以在此处了解有关响应类型的更多信息:https://developers.google.com/identity/protocols/OpenIDConnect#response-type

[1] https://developers.google.com/identity/protocols/OAuth2WebServer#redirecting

关于javascript - 授权代码请求时 Google OAuth2 response_type 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51842176/

相关文章:

javascript - JQuery隐藏/显示最接近的div

javascript - Accordion 打开时需要将 .down-arrow 类添加到 div

javascript - 如何在不传递按钮 ID 的情况下突出显示单击的按钮?

node.js - 寻找 JWT Auth 微服务示例

c# - 在 ASP.NET MVC 中重定向未经授权的 Controller

javascript - 有没有办法移动 Chrome 调试器中的程序计数器?

javascript - Gmail 插件 : Oauth not being triggered

oauth - OpenID Connect 为 OAuth 2.0 添加了什么(为什么 OAuth 2.0 不足以进行身份​​验证?)

ios - STTwitter CFNetwork 内部错误 NSURLRequest

ruby-on-rails - CanCan、Rails 和协作