0

I have use the code from this topic : Unable to get the subscription information from Google Play Android Developer API

I can get the refresh token from the uri

https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/androidpublisher&response_type=code&access_type=offline&redirect_uri=REDIRECT_URI&client_id=CLIENT_ID

I call getRefreshToken(token from URI) and the anwser is :

{
    "access_token" : "ya29.1.AADtN_XSr_9GwIybDh0fT5kt487DGYEed2sTzugp_MDOLEJAiMOTY3o17HwnvA7BIgP6",
    "token_type" : "Bearer",
    "expires_in" : 3407
}

With this acces token I can get information about my google android developper account.

The problem is the access token expires after 1 hour and I can't regenerate it. I try to call getAccessToken(token from uri) and the anwser is :

{
    "error" : "invalid_grant"
}

I use this code on a google app engine server in JAVA.

If someone recode thus methode with com.google.api.client.auth.oauth2 can be awesome.

jhamon
  • 3,603
  • 4
  • 26
  • 37
Kingstone59
  • 183
  • 3
  • 14

1 Answers1

2

Default first response when you get the refresh token is:

{ 
"access_token" : "****", 
"token_type" : "Bearer", 
"expires_in" : 3600,
"refresh_token" : "****" 
}

Every next response returns:

{ 
"access_token" : "****", 
"token_type" : "Bearer", 
"expires_in" : 3600,
}

You need delete oAuth from google account or use "approval_prompt=force" in request for force take refresh token.

Mikolay
  • 21
  • 2