Failed to get Google oAuth 2 token on POSTMan

Well, since the Other problem (solved) remains unresolved, I thought to use POSTMan to execute Trail and Error at every step that the client library will do.

So, I read the Basic steps in Google OAuth2 again, created another OAuth 2 identifier in Api Manager> Credentials in the Dev Console and the type ID is a web application and they are populated in POSTMan:

  • New tab in POSTMan, then click on the "Authorization" label.
  • Select a type as OAuth 2.0 and select "Add Token to URL"
  • URL: https://accounts.google.com/o/oauth2/v2/auth
  • Access Token URL: https://www.googleapis.com/oauth2/v4/token
  • Customer ID: [Customer ID I just received]
  • Client Secret: [client secret I just received)
  • Scope: [empty]
  • Grant Type: Authorization Code
  • Local access request locally: selected
  • Click Request Token
  • POSTMan answered me: "Failed to complete the login to OAuth2.0"

Did I miss something?

(Google redirect url can be found here )

(API scope can be found here )

+8
google-api google-oauth2 postman
source share
3 answers

You only get access to the token if a Google user signs up on the Google login page.

Step 1: redirect https://accounts.google.com/o/oauth2/auth?client_id= "+ GoogleClientID +" & redirect_uri = "+ Url.Encode (GoogleRedirectURL) +" & response_type = code & scope = email "

Step 2: Now you are on the google login page and enter your google credentials.

Step 3: Google will redirect you back to the redirect_uri that you configured in the Google Developer Console, and you can get the "code" from QueryString

Step 4: Now you submit the form https://www.googleapis.com/oauth2/v4/token with client_id, client_secret, redirect_uri, code (you received in step 3) and grant_type = authorization_code

Result: you should now get access_token from Google

+5
source share

I followed the Rajat instructions and they worked, but then I tried what the OP did again, but this time setting the scope of 'email' instead of leaving it empty, I got an invitation to enter my gmail credits and was able to get access token.

+1
source share

BigHomie’s email offer also worked for me. But I used a different URL and access URLs than BigHomie, because I think it was updated.

Authorization URL: https://accounts.google.com/o/oauth2/auth

Access Token URL: https://accounts.google.com/o/oauth2/token

+1
source share

All Articles