Jwt Flutter Authentication flow

Viewed 4367

I am trying to create a Flutter application with Jwt token authentication. I have referred this article as a starting point. But I want to refresh the tokens on like 15 minutes. So I don't think this article makes sense and also I want to add state management to this as well. I was thinking about Bloc or provider. Some help with implementing this.

1 Answers

Save the token in your local storage and use background_fetch to check the token expiration date (timestamp) after decoding it with this simple snippet code. If time the token is expired the call refresh_token api url

Related