刷新令牌

编程入门 行业动态 更新时间:2024-10-27 21:18:29
本文介绍了刷新令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在研究一个金融项目(Flutter),其中从后端获得的auth令牌频繁过期.

I'm working on a finance project (Flutter) where the auth token gotten from the back-end expires frequently.

只要用户正在使用该应用,如何防止令牌过期?

How can I keep the token from expiring as long as the user is using the app.

推荐答案

我的建议是,您可以以简单的方式处理事情,例如,如果令牌过期,则在获取数据时会收到401未经授权的异常,您可以在其中请求新令牌(刷新令牌),然后再次提出获取请求.让我知道它是否对您有用.

What I suggest is you can handle the things in simple manner like when fetching the data if the token expires you get a 401 unAuthorized Exception where you can ask for a new token(refresh Token) and then make the fetch request again. Let me know if it worked for you.

更多推荐

刷新令牌

本文发布于:2023-11-26 15:37:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1634291.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:令牌

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!