When I run $user->currentAccessToken()->delete();
the token expires, Auth::check()
becomes false
, what it is expected.
However, when I go to the personal_access_tokens
table, the token is still there. There is no soft delete field. How does Sanctum now that the token is expired?
I looked in the source code of sanctumm and it seems like it's a guard that handles it.
This means that the validating token proccess looks like this:
And upon fail, it's simply rejecting the request. Not deleting the token.
Deleting the token is however the manual way to revoke a token.