i've a webapp with a single page made in vue, because it's requiring highly complicated interaction flows from users into the page.
Here my user of Laravel is already loged in.
I am using sanctum, (because I'm using backpack for laravel).
I ask you if there is a simple way to allow any logged user to be anthenticated and authorized to call any api.
we have this example route
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
return $request->user();
});
In my page, using axios, I try to simply call axios.get('/user') but it returns me 'unauthorized'
I am doing api calls from same domain of webapp (so same domain of api)
Also, I added in the bootstrap.js file this line
windows.axios.defaults.withCredentials = true;
What is missing? As far as I know, every get send also all the cookies of the same domain to the server.
So I expect Laravel can detected as logged the user.
Why doesn't it happens?