-
Why does my Laravel API with Sanctum return 401 Unauthorized when I call a route with Authorization: Bearer ? |
Beta Was this translation helpful? Give feedback.
Answered by
Nxi-11
Aug 24, 2025
Replies: 1 comment 1 reply
-
For Sanctum to recognize your token, the route must be protected with the auth:sanctum middleware, and your user model must be set up to work with API tokens. If either of these is missing, Sanctum won’t authenticate the request and you’ll get a 401 Unauthorized response. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a lot Nabil