janmoes's avatar

Sending an Auth response to Vue using Lumen

I'm building a Vue app which is a dynamic menu. Which means the admin can add products to the menu, and those products will be shown on a card component. Because i need to have restricted pages for the admin to add products, i'm using Lumen from Laravel, to have a simple crud api. Although the problem in my situation is: How to handle Authentication through Vue and Lumen

I already read the docs but couldn't figure out how to imply that kind of code in my Vue project.

$app->get('/post/{id}', ['middleware' => 'auth', function (Request $request, $id) {
    $user = Auth::user();

    $user = $request->user();    
}]);

I want to know what the best way is to send a response from Lumen to Vue that lets Vue know that the admin has logged in and can acces for example '/dashboard'

0 likes
2 replies
janmoes's avatar

I know how those responses work, but the in between functionality is what confuses me. I want to be able to send a filled in username and password, lumen needs to check if it matches with a user in the database, if it matches, it should send back some sort of token that allowes the user to go to a restricted page in Vue

Please or to participate in this conversation.