User session is still valid after a database refresh

Viewed 253

On a Laravel API with authentication using Laravel Sanctum in SPA mode after a database refresh the session is still valid.

After running php artisan migrate:fresh --seed the previously logged-in user is not disconnected and can request the API with 200 status code, a valid response body and the Set-Cookie in the response's headers.

Does anyone have ever encountered this issue before?

1 Answers

Ok, I just got the answer from a friend of mine, the point is that with the default session driver in Laravel, file, sessions aren't deleted when refreshing the database.

I just ran rm -rf storage/framework/sessions/* and everything worked perfectly.

Related