-
Notifications
You must be signed in to change notification settings - Fork 755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refresh token lost on renewal #658
Comments
Can you provide more information? If you're encountering a problem with the refresh token or access token, can you show some snippets of code and explain what you're expecting to happen and what is actually happening? If you're proposing a feature, can you show some example code to illustrate what you're proposing? Thanks! |
I'm having the same issue. The refresh token is lost after the first refresh.
After the first refresh, the accessToken looks like
The initial/first accessToken looks like this (I moved it to another cache key)
The new/second/refreshed accessToken no longer has a refreshToken. This means the first refresh works, they second refresh will not work because the accessToken lost its refreshToken. |
This ticket can probably be closed. My issue was related to the Reddit client https://github.com/rtheunissen/oauth2-reddit. The userAgent isn't being properly set by the client. Used Guzzle instead and it works fine. |
This was initially a proposal for a new feature which I didn't communicate very well. Some API's use the same, original refresh token that you receive on the first request for every subsequent request, while other APIs give you a new refresh token and invalidate the old one every time you request a new access token. It would be much more convenient and easier to use / implement if this library always included the refresh token when requesting an access token, if the API you're connecting to does generate a new refresh token, that's included, if not, the previous (Current) request token is included instead. |
Agreed, I just came across the same issue using the Vend API. I can fix up in my code, but it would be far safer to do it in this library. Would you like a pull request? |
@stevenbrookes Feel free to submit a pull request for this feature. |
I ran into this issue with with google. The response from google when requesting a new token using a refresh token does not include a new refresh token. Google's advise to store the refresh token in permanent storage and use it with new requests. I had to change my storage mechanism to keep the refresh token intact with every request unless explicitly returned from the response. I wonder what's the best practice to do so using oauth2 client. |
Hello,
The refresh token is lost when used to renew the access token and no refresh token is sent with the access token.
Library needs to include the previous (Current) refresh token with the new access token if no new refresh token is provided.
The text was updated successfully, but these errors were encountered: