I follow the Laravel official document step by step.
When I send a request to {{host}}/api/login
, I can receive the response that includes the token. Everything is correct.
But when I try to send a request to {{host}}/api/user
, it is always unauthenticated.
I checked my code several times, I cannot fix it.
In my .env file, I set as following, my backend host is http://laravel_8_api.test
SESSION_DOMAIN=.laravel_8_api.test
SANCTUM_STATEFUL_DOMAINS=.laravel_8_api.test
How can I make it work? Please help me.
The code is in this link https://github.com/ramseyjiang/laravel_8_api