亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Laravel 9 JWT 注銷(xiāo)問(wèn)題 php-open-source-saver/jwt-auth
P粉809110129
P粉809110129 2023-12-12 08:38:04
0
1
685

我嘗試通過(guò)教程使用 php-open-source-saver/jwt-auth https://blog.logrocket.com/implementing-jwt-authentication-laravel-9/

它工作正常,但我在注銷(xiāo)時(shí)遇到一些問(wèn)題。

Auth::logout();

當(dāng)我注銷(xiāo)并嘗試調(diào)用我的測(cè)試方法時(shí),它使用舊令牌。

class SubjectController extends Controller
{
    public function __construct()
    {
        $this->middleware('auth:api');
    }

    public function show($id)
    {
        $subject = Subject::find($id);

        return response(json_encode($subject))
            ->header('Content-Type','application/json');
    }
}


P粉809110129
P粉809110129

全部回復(fù)(1)
P粉638343995

檢查文檔:https://laravel-jwt-auth .readthedocs.io/en/latest/auth-guard/

logout()

注銷(xiāo)用戶(hù) - 這將使當(dāng)前令牌無(wú)效并取消設(shè)置經(jīng)過(guò)身份驗(yàn)證的用戶(hù)。

auth()->logout();

// Pass true to force the token to be blacklisted "forever"
auth()->logout(true);
最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板