Closed LindaLawton closed 1 year ago
Hello, this issue is not relevant to these client libraries, so I'll be closing it out.
As a brief response to your question though, the refresh token is intended to be used to refresh your access tokens indefinitely, and there are in fact a finite number that your account may have active at any given time. In that sense, stepping through the OAuth 2.0 process to generate new refresh tokens frequently is essentially the opposite of how they are intended to be used.
If other libraries / languages are producing a new refresh token every time you refresh the access token, I would suggest that they are probably (incorrectly) stepping through the authorization step rather than simply refreshing the access token as intended.
The following example lists a users messages from the Gmail api using web flow.
My question is. Why does the authorization only return a refresh token after the first authorization request. I have added offline access, the first time the user authorizes this code a refresh token is returned. It is not returned again, the only way to force it to return again is to add
prompt= "consent"
.I have had to add a check in the oauth2callback method in order to check that there is a refresh token and to not save my credentials if the refresh token does not exist, as it was over writing it every time the access token was refreshed.
Is there something that I need to set on the client to ensure that it always returns a new refresh token when the access token is refreshed. I thought this was a standard feature in Google authorization server it i always get a new refresh token in other languages. Or is the issue that this is a web client?
code
Cross posted Why do i not get a new refresh token returned with every authorization request?