授权代码请求中的Google OAuth2 response_type错误 [英] Google OAuth2 response_type error on authorization code request
问题描述
我正在尝试从Google+ API获取授权代码,如第1步(设置授权参数)(HTTP/REST).
I'm trying to get an authorization code from Google+ API, as described in Step 1(Set authorization parameters) (HTTP/REST).
正如我在此处阅读的,Google授权服务器具有以下强制性查询字符串参数: client_id , redirect_uri 和 scope ,因此我的href看起来像这样:
As I've read there, the Google authorization server has the following mandatory query string parameters: client_id, redirect_uri and scope, so my href would look like this:
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)
When trying to access that link, I get the following error: Error: invalid_request (Required parameter is missing: response_type)
但是,该参数列表中根本没有指定 response_type 参数!
Though, the response_type parameter is not specified in that parameter list at all!
有什么想法可以解决吗?
Any ideas how this can be solved?
已修复.似乎我的代码编辑器中的空格也以%20"的形式插入了我的链接,这就是为什么它不起作用的原因.
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.
推荐答案
由于您正在关注服务器文档,因此在下一步[1]中的示例授权请求URL中将存在response_type = code参数.
Since you're following the server documentation, the response_type=code parameter is present in the sample authorization request URL in the next step [1].
您可以在此处了解有关响应类型的更多信息: https://developers.google.com/identity/protocols/OpenIDConnect#response-type
You can learn more about response types here: https://developers.google.com/identity/protocols/OpenIDConnect#response-type
[1] https://developers.google.com/identity/protocols/OAuth2WebServer#redirecting
这篇关于授权代码请求中的Google OAuth2 response_type错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!