Laravel Passport token lifetime

前端 未结 10 1449
轮回少年
轮回少年 2021-01-04 01:12

I don\'t get what I\'m doing wrong. I can\'t set token expiration time.



        
10条回答
  •  一个人的身影
    2021-01-04 01:45

    The Passport docs seem to answer this question

    https://laravel.com/docs/5.6/passport#token-lifetimes

    In the boot method of AuthServiceProvider call Passport::tokenExpiresIn()

    public function boot()
    {
        $this->registerPolicies();
    
        Passport::routes();
    
        Passport::tokensExpireIn(now()->addDays(15));
    
        Passport::refreshTokensExpireIn(now()->addDays(30));
    }
    

提交回复
热议问题