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,851
  • 2
  • 25
  • 38
  • Possible duplicate of [Using Postman to access OAuth 2.0 Google APIs](https://stackoverflow.com/questions/32076503/using-postman-to-access-oauth-2-0-google-apis) – DaImTo Dec 04 '18 at 08:12
  • I tryed to generate token within Postman in Oath2 page- but got error "Could not complete oauth2.0 login" – Julia Rusalova Dec 04 '18 at 15:57

1 Answers1

0

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