2

I want to get subscription data using Purchase.Subscription API. For this I am trying to get token from https://accounts.google.com/o/oauth2/token.

As per documentation ,It should return me following response:

{
  "access_token" : "ya29.ZStBkRnGyZ2mUYOLgls7QVBxOg82XhBCFo8UIT5gM",
  "token_type" : "Bearer",
  "expires_in" : 3600,
  "refresh_token" : "1/zaaHNytlC3SEBX7F2cfrHcqJEa3KoAHYeXES6nmho"
}

But when I tried to follow same steps, I am not getting refresh_token field in response. I am sending below fields as mentioned in documentation:

grant_type=authorization_code
code=<the code from the previous step>
client_id=<the client ID token created in the APIs Console>
client_secret=<the client secret corresponding to the client ID>
redirect_uri=<the URI registered with the client ID>

Please help me what I am missing.

chikka.anddev
  • 9,569
  • 7
  • 38
  • 46

1 Answers1

1

ok. I found actual issue. This is really lack of documentation on API side. We will have refresh_token value only for first time calling api https://accounts.google.com/o/oauth2/token with below data after allowing app to manage your developer account:

grant_type=authorization_code
code=<the code from the previous step>
client_id=<the client ID token created in the APIs Console>
client_secret=<the client secret corresponding to the client ID>
redirect_uri=<the URI registered with the client ID>

If you are not getting refresh_token, you can follow steps as mentioned in this answer and try to fetch refresh_token again

chikka.anddev
  • 9,569
  • 7
  • 38
  • 46