Open beibl opened 4 years ago
VerifyCsrfToken middleware is only applied to your web routes, but your login endpoint is in the api routes
@rs-sliske here is the EnsureFrontendRequestsAreStateful class and it has sanctum's VerifyCsrfToken middleware
@beibl check out the docs: https://laravel.com/docs/8.x/sanctum#spa-authenticating
The first request must be to the csrf route to set the XSRF-TOKEN
, which is then matched in the CSRF middleware
@paras-malhotra Did you understand the issue here?! Am I making myself clear, or should I rephrase?
Here is the simple form which doesn't have any csrf tokens to send to the server:
And here - the login method:
This is the Kernel.php:
And here is the cors.php:
Same thing with Postman - it just gets authenticated without requesting csrf cookies or without any errors!