I installed Lumen and tried to authenticate.
I am using the Laravel Framework Lumen version (5.3.3) (Laravel 5.3. * Components).
In app.php, I uncommented the following.
$app->withFacades();
$app->routeMiddleware([
'auth' => App\Http\Middleware\Authenticate::class,
]);
$app->register(App\Providers\AuthServiceProvider::class);
IN \app\Providers\AuthServiceProvider.php
public function boot() {
$this->app['auth']->viaRequest('api', function ($request) {
if ($request->input('api_token')) {
return User::where('api_token', $request->input('api_token'))->first();
}
});
}
Here, when I am debugging, the method is viaRequestnot executed.
source
share