Can you share your sanctum & cors configuration file?
Laravel Sanctum API Auth keeping state
Hello, I'm implementing Laravel Sanctum Api auth for my Laravel + vue project. I had no problems defining the login system, so I can login without problems, I can see the XSRF-TOKEN correctly in the requests and access to api routes protected by auth:sanctum middleware, so far fine.
The problem comes when I reload the page, so obviously the csrf token changes, so I send again the request of /sanctum/csrf-cookie but the user needs to login again.
So I really can't understand and think that it should be like that, I mean, is a pain in the ass that the user needs to login each time that he closes the browser.
Can someone help me with some light, please ?
Sorry. I have solved the problem.
First mistake was that I was doing the login POST request to api/login when I just realized that it should be in the web.php (thing that I don't understand why, but whatever)
Second mistake was that for some reason I had some middlewares commented on the "web" middleware group, so I just uncommented, and it worked.
Thank so much for your time.
Please or to participate in this conversation.