mardi 2 octobre 2018

Implement basic auth in some routes

I have a API in lumen framework and I'm using passport to authenticate the routes but I need that some routes use basic auth (with users table data and pront to enter user/pass) instead passport.

bootstrap/app.php

$app->routeMiddleware([
    'auth' => Froakie\Http\Middleware\Authenticate::class,
    'auth.basic' => Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
    'validateJson' => Froakie\Http\Middleware\ValidateJsonMiddleware::class,
]);

routes.php

$router->get('/test', ['middleware' => ['auth.basic'], function () {
    return view('welcome');
}]);

I try that but returns a error.

enter image description here



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire