How to specify auth guard when using multiple guards with Sanctum #preamble Preamble https://laravel.com/docs/sanctum is the go-to solution for token-based API authentication and SPA (Single page application) authentication. It uses an authentication guard when performing the SPA authentication.
If your web app has multiple panels (say, admin, manager, customer, etc)., you'd be using multiple authentication guards.
Assuming that our web app follows this pattern in the API endpoints, we can decide the auth guard dynamically inside the middleware.
//... ]; And with this, your web app should be using the respective auth guard to protect the routes as per the user type.