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

Auto retry after refresh token? #54

Open
a7md0 opened this issue Dec 1, 2021 · 1 comment
Open

Auto retry after refresh token? #54

a7md0 opened this issue Dec 1, 2021 · 1 comment

Comments

@a7md0
Copy link

a7md0 commented Dec 1, 2021

Hello, I have been using fresh_dio package for a Dio http client. I was able to implement the refreshToken + shouldRefresh functions, and it is refreshing the token whenever the http call fail based on my conditions.

However, the initial fired request does fail. Is it possible to retry the request after refreshing the token? If not, what best approach to handle this? Should I create an interceptor which check the token expiration time before firing the request?

@vasilich6107
Copy link

@a7md0 it should retry the request with updated token based on this code
https://github.com/felangel/fresh/blob/master/packages/fresh_dio/lib/src/fresh.dart#L121

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