See if this post helps: https://laracasts.com/discuss/channels/laravel/how-to-refresh-sanctum-token
Oct 27, 2022
5
Level 1
Laravel Sanctum token refresh
Hello, I recently started using Sanctum for API and I use the token based authentication. I have set token life to 60 minutes but I don't know how to manage token refreshing, because after 60 minutes the token becomes invalid and I cant determine the user which I want to generate new token - i get Unauthenticated response. I could just redirect client side to login page again but I do not want that - i want the refreshing to happen in the background. I could just set token life to 65 minutes and refresh the token after 60 min but I do not know if that is good practice and secure. Thanks!
Please or to participate in this conversation.