I'm in Laravel 5.6. I have all my API routes built out and properly responding to requests from my REST client (Paw). I'm trying to build a simple front end to access those routes.
I'm trying to use Laravel's out-of-the-box features as much as possible, so I'm using Axios to call those routes from a blade template using Vue.js. It works if I disable auth middleware on the test route, but I get 401 errors on the console when auth middleware is enabled for the route.
The problem seems obvious enough... The auth:api guard on my /api routes wants to see an oauth token in the header, but when I log in with the web page it does session authentication. I assume there's a simple way to resolve this without having to spoof an oauth token request in the web frontend, right? Do I need to somehow pass the session token in my request with Axios? And, if so, do I also need to change the auth:api guard in my api routes file?
auth:apimiddleware requires each user to have a field in the database calledapi_token, did you add one?usertable calledremember_tokenand my API routes are all working properly with OAuth from my REST client. The issue is consuming those same API routes from the Vue.js / Axios front end I'm trying to build.undefinedback from Axios, even when I disable all auth. Notably, I see a 404 error in the console for/js/bootstrap.js.map. Searches for that issue bring back a million hits, but no working answers./js/bootstrap.js.map, but that doesn't seem to matter because I get the desired result when I disable auth on the route. So I'm back to where I was when I first posted this question and still don't have a working solution.