Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Laravel5 中的案例。
当我收到提示“令牌过期”时,如何刷新并获取新令牌?
我一直在使用JWTAuth::refresh($oldToken),但它不起作用。
JWTAuth::refresh($oldToken)
什么是最好的方法?
您最后一次更新/安装软件包是什么时候?几天前发布的0.5.2版本修复了令牌无法正确刷新的问题。尝试运行作曲家更新,看看是否能解决您的问题。
我发现这是包裹的问题。我提交了一个拉取请求来修复它。
令牌正在被验证,并在它有机会刷新令牌之前引发错误。
可能此代码可以帮助获得新令牌:
public function refreshToken(Request $request) { $odlToken = $request->input('token'); if(!$odlToken) return response()->json(null); $token = JWTAuth::refresh($odlToken); return response()->json(compact('token')); }