Vue cookie-based authentication in Laravel

From reading the Laravel docs, it appears that when using Sanctum Vue will just use the cookie-based authentication.

I was trying to move an existing app (with login done using Livewire) to Vue, but calls direct to my first api endpoint were redirecting to the login page.

So I created a clean installation of Larvel, installed Breeze (with Inertia), then Sanctum, published the config etc.

But when I login and then visit my test endpoint (which just returns 200 Ok), it redirects to the login page (which, because I am logged in, redirects to the Breeze dashboard).

Do I need to do anything manually for my endpoint, guarded by auth:sanctum, to pass authentication?

Source: Laravel

Leave a Reply