1

I need to create request for getting data from Google Analytics API in Postman. I managed to generate access token with playground platform but I need permanent refresh token (in playground I can generate only 24h token).

I tried to generate token in Console API:

  1. I've created project
  2. Add analytics API in my project
  3. Generate client ID and secret code

But I don't know which redirect URL using. Default value that was generate in JSON is urn:ietf:wg:oauth:2.0:oob","http://localhost

Than I've generated authorization code with request (from browser):

https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/analytics&redirect_uri=http://localhost&response_type=code&client_id=XXXX

And when I tried to generate access_token with POST request in Postman, sending such keys:

code:XXXXXX
redirect_uri:urn:ietf:wg:oauth:2.0:oob (also tryed http://localhost)
client_id:YYYYY
client_secret:ZZZZZZ
scope:https://www.googleapis.com/auth/analytics
grant_type:authorization_code

And got error

{
    "error": "invalid_grant",
    "error_description": "Bad Request"
}

How should I set grant for Postman? Could you help me to resolve issue and understand what I do wrong

alseether
  • 1,889
  • 2
  • 24
  • 39

1 Answers1

1

I managed to resolve my issue. It should be added redirect_url https://www.getpostman.com/oauth2/callback