Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mvind's avatar
Level 1

401 Api Auth error after composer autoload

Hi guys!

So my application consumes its own api, and prior to today this worked flawlessly. Today I merged a new feature into the project and now I get a 401 error on all my axios calls to my own Api.

I been trying to solve this problem for around 7 hours now, and I'm borderline going insane..

I have tried:

  1. I have tried php artisan optimize:clear
  2. I have tried to generate new passport keys with php artisan passport:keys --force
  3. I have completely wiped my db with php artisan migrate:fresh
  4. I have generated new application keys and then new passport keys and the cached the new configs
  5. I have tried to delete composer.lockand then composer update

Nothing has worked so far, I'm really at loss as to what is the problem. I could perfectly well consume the api prior to today, and then when I merged the feature into the main branch I got this error.

Does anyone have tips or tricks?

0 likes
1 reply
mvind's avatar
Level 1

I forgot to mention after the merge I ran composer install --optimize-autoloader --no-dev. I have also tried to revert back to the commits before the merge, but the 401 error is persistent

Please or to participate in this conversation.