php - 如何扩展jwt时间?Jwt 版本:“tymon/jwt-auth”:“^1.0.0-rc.2”Laravel 5.7
问题描述
如何延长令牌的期限?我的功能已过期,但无法正常工作。
protected function respondWithToken($token)
{
return response()->json([
'token' => $token,
'token_type' => 'bearer',
'expires_in' => auth()->factory()->getTTL() * 464465353454316000,
'user' => auth()->user()
]);
}
}
令牌很快过期。
'expires_in' => auth()->factory()->getTTL() * 464465353454316000 //this line not work property. Token expired early
解决方案
试试这个,它对我有用:
use JWTAuth;
...
'expires_in' => JWTAuth::factory()->getTTL() * 24,
推荐阅读
- git - git lfs ls-files 的特定提交
- bash - Shell 脚本:如何从大型语料库中复制具有特定字符串的文件
- awk - gawk 中的意外括号错误
- python - 如何在单个声明中创建多个空类?
- python - 具有用户定义字段和外键选择的 ModelForm
- node.js - Nodejs-将数据导出到excel时在单元格中进行TextWrap
- javascript - 从一个数组中删除代表另一个数组的重复数据
- c# - asp:literal 控件上如何避免xss?
- javascript - React JS 中 webpack.config.js 中的这个相对路径有什么问题?
- c# - 在 Word 中模拟从另一个 VSTO 插件单击功能区按钮