There could be several reasons why Laravel sanctum is unauthenticated on a live server:
Incorrect base URL: Make sure the base URL in the .env file matches the domain where the app is hosted.
Session driver not configured: Laravel sanctum requires a session driver to be configured in the .env file. If it is not set, sanctum will not be able to authenticate users.
Missing CSRF token: Make sure that the CSRF token is included in your requests. Without it, sanctum will not be able to authenticate users.
Firewall or security settings: Sometimes, firewalls or security settings on the server can prevent sanctum from working correctly. Make sure that the server allows the necessary ports and protocols.
Incorrect configuration settings: Check that the configuration settings for sanctum are correct in the config/auth.php file.
Invalid tokens: If there are invalid tokens stored in the database, they could cause authentication issues. Make sure to clear out any invalid tokens.
Asked: 2023-04-29 10:36:23 +0000
Seen: 10 times
Last updated: Apr 29 '23