[Vuejs]-Laravel, Vuejs, axios get posts for logged in user

0👍

You are using the auth:api middleware, this is by default a token based authentication but I don’t see you adding any Bearer token header.

There are 2 possible solutions that I know.

  1. If you want to keep using the auth:api middleware, request an api token and use that in your requests (https://laravel.com/docs/6.x/api-authentication), but it would be better to switch to Laravel Passport
  2. Personally I would use web auth for this (session based), after you login a session token will be added and you don’t really have to do much with it because it will be added to all calls after that

Leave a comment