Since Laravel comes with Frontend Scaffolding and supports Vue within the box, therefore I decided to test Laravel 5.7 + Vue app running in same project.
I personally like keeping API/Micro service and App as two separate projects. But in certain situations using Laravel+Vue app in same project could be helpful.
While I was testing API+Laravel Passport & Vue app, I encountered an error “Route [login] not defined” when hitting any auth:api guarded endpoint without passing valid Bearer token.
Laravel introduced Authenticate middleware in version 5.7, that redirectes any unauthenticated request to login route by default.
Since I am using Laravel Passport, there I didn’t activated Auth::routes() in application, and for that obvious reason my app is missing web auth routes.
Authenticate middleware default behavior redirects the unauthenticated request to no existing /login route.
Requesting api auth guarded endpoint without valid token, throws InvalidArgumentException.
Middleware:
This error can be resolve by just commenting out.
// return route('login');