I love
@laravelphp and building with it, and considered myself pretty good at it.
But today was one of those days when I got humbled and now thinking if I should event consider myself good at web dev.
For context, I am using Laravel Sanctum for a new project, it's going to be a multi-tenant SPA, and I was using
@GetInsomnia to document the new APIs.
I followed the excellently written laravel sanctum guide, everything went smoothly initially but then I noticed I am getting 419 status code and a "csrf token mismatch" for POST requests.
Weird I thought, but I made sure I followed the guide, re-read it couple times, went through everything and nothing worked.
The official guide mentions you have to send a x-xsrf-token header, which I was doing. The cookies were working and automatically handled by Insomnia, so there was nothing wrong!
Then I thought, as it's a multi-tenant setup, maybe it's something to do with domain & cookies.
So I wasted almost 5 hours trying to find it, and nothing worked 😫
And then I saw a nice looking "=" at the end of the csrf token, I converted that to an "=" and now everything is working 🤡🤡🤡