简体   繁体   中英

Flutter - How to Auto Refresh token in flutter

What can be the best approach to auto refresh token in flutter? I found this solution but is there any better approach than this?

This depend on where you're requesting your token from. If you're using firebase for example, firebase will handle this for you with it's auth package. If you're using your own API, apart from the solution you mentioned, you could also store your token with it's expire date with a package such as SecureStorage and perform a check if the token will almost expire and in that case request a new one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM