As of writing this answer, the token now deletes from the database so that one is settled.
How Sanctum knows if a token is expired is pretty simple:
- The token has a created date, call it C
- The config data in config/sanctum.php has an expiration time, call it E
- The current time you want to use the token is right now, call it N
To check for expiry, it subtracts N from C. If N - C is less than E, the token hasn't expired yet. If it is greater, the token is expired.
Example:
- You created a token at 5:00 AM
- The expiration time is set for 5 hours
- You want to access data through the token at 8:00 AM
When you subtract 8 from 5, you get 3. That's just 3 hrs since you created the token. Not up to the 5 hrs you set.
If you were accessing data at say, 11:00 AM, then the time frame becomes 6 hrs, which is more than 5 hrs, meaning the token has expired.
sanctum.php
inside'expiration' => null,
you can set – Cutcheon