I'm trying to get vue + axios to connect with my Laravel 12 backend. I've tried to follow documentation and can login and request data. As soon as I try to wrap my non-public api routes with auth:sactum, I get errors.
I have configured in my .env:
SANCTUM_STATEFUL_DOMAINS=http://localhost:5173
This stops CSRF complaints.
I can see axios sending an X-Xsrf-Token header in the requests, but alas, Sanctum is denying them with 401's.
I can also see that the request headers include referrer and origin, my cookie with both my session ID and xsrf token, etc.
My protected api routes are in a routeGroup...
'''
Route::group(['middleware' => ['auth:sanctum']], function() {
Route::get(...
'''
A lot of documentation suggests X-Csrf-Token (rather than -Xsrf-).
I'm not sure why this has to be made so difficult.