Jwt Flutter 认证流程

Jwt Flutter Authentication flow

我正在尝试使用 Jwt 令牌身份验证创建一个 Flutter 应用程序。 我将 this article 作为起点。但我想在 15 分钟左右刷新令牌。所以我认为这篇文章没有意义,我也想在其中添加状态管理。我在考虑 Bloc 或提供商。 一些帮助实现这个。

将令牌保存在本地存储中并使用 background_fetch to check the token expiration date (timestamp) after decoding it with this 。如果令牌过期,调用 refresh_token api url