[Vuejs]-Laravel returns unauthorized with second request

0👍

It returns unauthorized because the call to the endpoint doesn’t have access token of the user.

The idea is that when you login auth:sanctum returns access token to the client so that it can use it to access the data in all of it’s next calls.

To do that you need to use authentication module in nuxt check this

The problem you are going to face next is that SPA doesn’t have middleware so you need to set your app as universal instead of spa to be able to use the middleware in the client side

Leave a comment