no0by5
no0by5

Reputation: 632

Laravel Passport token expiry

I'm using Laravel Passport to authenticate users for my single page application. I would like the access token to expire if it wasn't used for some time and refresh the expiry time, whenever it is used. I only found a way, to set the expiry time to a fixed time.

Upvotes: 0

Views: 719

Answers (1)

Moubarak Hayal
Moubarak Hayal

Reputation: 209

Well first of all you should show you code so we can help you in a better way.

From what you said you want to set an expire date to you token if not used and when used make the expire date longer.

you can use the Pasport moethods to get the result you need. Example:

    Passport::personalAccessTokensExpireIn(Carbon::now()->addHours(<Hours you want>));
    Passport::refreshTokensExpireIn(Carbon::now()->addDays(<days you want>));

Hope this helps Good luck

Upvotes: 2

Related Questions