简体   繁体   English

Jwt Flutter 认证流程

[英]Jwt Flutter Authentication flow

I am trying to create a Flutter application with Jwt token authentication.我正在尝试使用 Jwt 令牌身份验证创建 Flutter 应用程序。 I have referred this article as a starting point.我把这篇文章作为一个起点。 But I want to refresh the tokens on like 15 minutes.但我想在 15 分钟后刷新令牌。 So I don't think this article makes sense and also I want to add state management to this as well.所以我认为这篇文章没有意义,我也想在其中添加 state 管理。 I was thinking about Bloc or provider.我在考虑 Bloc 或提供者。 Some help with implementing this.一些帮助实现这一点。

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 .将令牌保存在本地存储中,并在使用此简单代码段解码后使用background_fetch检查令牌到期日期(时间戳)。 If time the token is expired the call refresh_token api url如果令牌过期,请调用 refresh_token api url

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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