我正在尝试从 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 参数根本没有在该参数列表中指定!
有什么想法可以解决这个问题吗?
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/