且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Laravel Passport令牌寿命

更新时间:2023-12-04 10:31:28

以下是用于更新所有授权类型的到期时间的方法:

Here are the methods used to update expiration time for all the grant types :

个人访问令牌:

public function boot(){
        $this->registerPolicies();

        Passport::routes();
        Passport::personalAccessTokensExpireIn(Carbon::now()->addHours(24));
        Passport::refreshTokensExpireIn(Carbon::now()->addDays(30));
}

全部休息

public function boot(){
        $this->registerPolicies();

        Passport::routes();
        Passport::tokensExpireIn(Carbon::now()->addHours(24));
        Passport::refreshTokensExpireIn(Carbon::now()->addDays(30));
}

只需在AuthServiceProvider的启动方法中更新以上代码即可.

Just update the above code in the boot method of AuthServiceProvider.