Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

GodziLaravel's avatar

Laravel sanctum: should we limit the token life?

Hello,

I'm wondering when using Laravel Sanctum if it is better to limit the token life for more security !

If yes (30 min) does the user required to post his user name and password every 30 minutes?

Thanks

0 likes
2 replies
krisi_gjika's avatar

you can overwrite the validity check to check against the last_used_at column instead. So rather than: created_at + config('sanctum.valid_for') <= now() check last_used_at + config('sanctum.valid_for') <= now()

Please or to participate in this conversation.