Skip to content
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 trigger token refresh? #102

Open
WiraDKP opened this issue Dec 22, 2023 · 1 comment
Open

How to trigger token refresh? #102

WiraDKP opened this issue Dec 22, 2023 · 1 comment

Comments

@WiraDKP
Copy link

WiraDKP commented Dec 22, 2023

tldr;
What is the best practice to refresh the token or how would you recommend triggering it?

The example has provided a refresh endpoint (/refresh). When the access token has expired, it seems to raise AuthJWTException. Do we capture the exception and redirect to the /refresh endpoint? How to do it?

Thank you in advance 🙏

@salmansyyd
Copy link

I had the same question but then after thinking a little the /refresh logic works in the frontend when the auth_token expires back-end returns an exception that is handled on the front-end, it should send another request to the /refresh endpoint this time with the refresh token and it will return the auth_token and this cycle will continue until the refresh_token is expired.

When the refresh_token is expired the /refresh endpoint will return an exception and this is when the front-end will redirect the user to the login page, and another cycle will start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants