Google OAuth2 response_type error on authorization code request

丶灬走出姿态 提交于 2021-02-11 13:35:58

问题


I'm trying to get an authorization code from Google+ API, as described in Step 1(Set authorization parameters) (HTTP/REST).

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

When trying to access that link, I get the following error: Error: invalid_request (Required parameter is missing: response_type)

Though, the response_type parameter is not specified in that parameter list at all!

Any ideas how this can be solved?

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:


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].

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



来源:https://stackoverflow.com/questions/51842176/google-oauth2-response-type-error-on-authorization-code-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!