-
Notifications
You must be signed in to change notification settings - Fork 257
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
How to refresh access token with grant? #149
Comments
Hi @samuelmtimbo, refreshing an access token is pretty trivial. Pick an HTTP client and make request to the refresh token endpoint of your provider, you don't need Grant for that. Check out these docs or the documentation of the provider you are using. |
Hi @simov. The docs point out the process of refreshing an access token has similarities with the process of getting the access token for the first time. It requires sending the Isn't Grant's purpose to abstract away this sort of communication with multiple providers? I would suggest a "/refresh/[provider]" internal endpoint. I can send a PR if that makes sense to you. |
The problem is that you have to store your That might be the session itself, in case you are using external session store, but it might be something else. So that's implementation detail on your end, and that's why you have to implement that endpoint yourself. On the bright side it shouldn't be that difficult to do so, and as you have guessed that sort of endpoint is going to work for 99% of the available OAuth2.0 providers. |
That makes sense. What if such endpoint received the |
The main reason behind this feature is that it would evolve alongside with Grant, growing as new providers are added and possible custom logic that come with them. |
Just keep in mind that storing the I think it's best to pass some user identifier to the refresh endpoint and based on that find the |
I understand. I'd rather not influence a bad practice. Thanks for the attention! |
Not a problem @samuelmtimbo, and I appreciate your feedback! It's not a bad idea either, it's just that most likely it won't be implemented in Grant. Might be a separate library or a Grant compatible middleware like grant-profile and grant-oidc. |
Pardon my naive, as I am still getting used to OAuth2 and grant, but I am failing to find a way to refresh an expired access token using grant. I expect that to be a fairly common scenario.
The text was updated successfully, but these errors were encountered: