Search code examples
authorizationgoogle-oauth

how to fix google oauth authorization request response 400 (Oauth error) !! 1


I have requested on https://accounts.google.com/o/oauth2/v2/auth to get authorization code but only get 400 Oauth error !! 1. Can you give request format and params so that I can get where am i getting wrong ?

Here is request :
https://accounts.google.com/o/oauth2/v2/auth?scope=https://mail.google.com/&redirect_uri=https://www.msn.com&access_type=offline&client_id=*********.apps.googleusercontent.com&response_type=code&include_granted_scopes=true

Solution

  • You do realize that this is only the consent url you are using. There will be additional calls after this.

    This is the link I use to request the consent form from the user. You will only need to change the redirect uri for yours. Remember the response will be returned to the redirect uri in that instance.

    Get https://accounts.google.com/o/oauth2/auth?client_id={clientid}.apps.googleusercontent.com&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=https://www.googleapis.com/auth/analytics.readonly&response_type=code

    Code ripped from Google 3 Legged OAuth2 Flow