Using Sanctum:
- Define an API route.
- Add the
auth:sanctummiddleware on that route. You can use the ability middleware for additional authorization checks, if needed.
You can issue API tokens for users using $user->createToken(). The token needs to be included in API requests as a Bearer token. That means API requests should have a header like this:
Authorization: Bearer your-plain-text-token-here
P.S. APIs are meant for machine-to-machine communication, not direct end user interaction. Tools like Postman are intended for development and debugging.