问题描述
我想将JWT令牌的到期日期设置为自发行之日起两年。
我下面有这段代码,并将其放在wordpress中的function.PHP中,但由于401错误,JWT令牌似乎很快过期,因为它不允许我发出请求:
/**
* Change the token's expire value.
*
* @param int $expire The default "exp" value in timestamp.
* @param int $issued_at The "iat" value in timestamp.
*
* @return int The "expire" value.
*/
add_filter(
'jwt_auth_expire',function ( $expire,$issued_at ) {
// Set $expire to 2 years.
$expire = time() + (DAY_IN_SECONDS * (2 * 365));
return $expire;
},10,2
);
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)