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

christonic's avatar

Error 404 when trying to connect to Laravel Passport API through VUE.JS

Greetings,

I have a little personal project I 've been working on that was built on top Laravel, it occured to me to migrate its front end to mainly Vue Js and decided to make my controllers available through an API for learning purposes.

I followed step by step the official guide to install passport and watched the 2016 Laracast video that shows how to connect to an APi with VueJs but it isnt working for me, when I hit my endpoint it throws a 404 Error.

Any idea of what is happening?

In the link below you will see screenshots of my code.

https://imgur.com/a/5uFGfqy

0 likes
7 replies
TerrePorter's avatar

Did you try it without the middleware? That would isolate to being related to the auth:api or some other issue.

christonic's avatar

Yes, I tryed it but got no different response.

TerrePorter's avatar

Do other routes work?

You might check php artisan route:list and see if everything looks right.

christonic's avatar

Yeah, everything always looked okay in route:list. Even cleared all cached files and double checked everything but it just wont work with Laravel Passport enabled.

munazzil's avatar

Have done every think and run below command in your CMD,

  npm run dev

and then run below command to view the out put in the url

  php artisan serve
KristianJust's avatar

Routes defined in the routes/api.php file are nested within a route group by the RouteServiceProvider. Within this group, the /api URI prefix is automatically applied so you do not need to manually apply it to every route in the file. You may modify the prefix and other route group options by modifying your RouteServiceProvider class.

You might want to try accessing /api/expenses/historic if the route was added inside api.php routes file.

Please or to participate in this conversation.