gpt4 book ai didi

laravel - Laravel sanctum 如何使 token 过期?

转载 作者:行者123 更新时间:2023-12-04 00:53:59 36 4
gpt4 key购买 nike

当我跑 $user->currentAccessToken()->delete(); token 过期,Auth::check()变成 false ,这是预期的。
然而,当我去personal_access_tokens表, token 还在那里。没有软删除字段。 Sanctum 现在 token 过期了怎么办?

最佳答案

可以在config/sanctum.php数组中设置节点过期时间

/*
|--------------------------------------------------------------------------
| Expiration Minutes
|--------------------------------------------------------------------------
|
| This value controls the number of minutes until an issued token will be
| considered expired. If this value is null, personal access tokens do
| not expire. This won't tweak the lifetime of first-party sessions.
|
*/

'expiration' => 60 * 24 * 7,

关于laravel - Laravel sanctum 如何使 token 过期?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64117057/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com