title: Getting token in Google Analytics API for Postman
body: <p>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).</p>
  
  <p>I tried to generate token in Console API:</p>
  
  <ol>
  <li>I've created project</li>
  <li>Add analytics API in my project</li>
  <li>Generate client ID and secret code</li>
  </ol>
  
  <p>But I don't know which redirect URL using. Default value that was generate in JSON is urn:ietf:wg:oauth:2.0:oob","<a href="http://localhost" rel="nofollow noreferrer">http://localhost</a></p>
  
  <p>Than I've generated authorization code with request (from browser):</p>
  
  <pre><code>https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/analytics&amp;redirect_uri=http://localhost&amp;response_type=code&amp;client_id=XXXX
  </code></pre>
  
  <p>And when I tried to generate access_token with POST request in Postman, sending such keys:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>And got error</p>
  
  <pre><code>{
      "error": "invalid_grant",
      "error_description": "Bad Request"
  }
  </code></pre>
  
  <p>How should I set grant for Postman? Could you help me to resolve issue and understand what I do wrong</p>