本文介绍了刷新令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在研究一个金融项目(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.
更多推荐
刷新令牌
发布评论