4 months ago

Logic Architecuture for passport token expire time

Posted 4 months ago by YeZawHein

I don't know that much about passport.I need advice for passport token expire time.I searched for it but I still haven't found any appropiate answer. When user click remember_me token lifetime should be long-lived. So,


 if ($request->remember_me) {
        } else {

It works but I think that isn't not appropiate solution.I didn't want to set this logic in AuthServiceProvider.php.I want to handle in controller.

if ($request->remember_me) {
        Passport::personalAccessTokensExpireIn(Carbon::now()->addHours(1));//it doesn't work

            $token->expires_at = Carbon::now()->addHours(1);//only work in database value ,it doesn't affect for passport

    Passport::personalAccessTokensExpireIn(Carbon::now()->addMinutes(1)); //I want to put this default.

Any your advice will be greatly appreciated.

Please sign in or create an account to participate in this conversation.