I developed an application which integrates with google api.
First part initially went ok:
- prompt consent, obtaining for the first time access token, and refresh token.
This is OK.
The issue is when I want based on my refresh token to obtain next sequence of valid access token and refresh token
Endpoint that I tried:
https://oauth2.googleapis.com/token
body (x-www-form-urlencoded):
client_id: xxx
client_secret: xxx
refresh_token: xxx
grant_type: refresh_token
But Im only get:
{
"access_token":"xxx",
"expires_in":3599,
"scope":""https://www.googleapis.com/auth/userinfo.email openid https://www.googleapis.com/auth/calendar",
"token_type":"Bearer",
"id_token":"xxx",
}
On the first time, when I hit prompt window, there is a parameter access_type: offline
Here is the example of the auth consent screen:
https://accounts.google.com/o/oauth2/v2/auth?client_id={clientId}&response_type=code&scope=https://www.googleapis.com/auth/calendar%20https://www.googleapis.com/auth/userinfo.email&redirect_uri={redirecturi}&access_type=offline&prompt=consent
Is there any way to make it work just in a “loop” scenario:
Once when my refresh token is 5 days befiore its expiration date (refresh tokens lasts for 90 days btw), then obtain a new refresh token for me?