Laravel return json not authentication
Open app\Http\Middleware\Authenticate.php
protected function redirectTo($request)
{
if( $request->is('api/*')){
abort(response()->json(['status' => 401, 'message' => 'Unauthorized'], 401));
}
if (! $request->expectsJson()) {
return route('login');
}else{
abort(response()->json(['status' => 401, 'message' => 'Unauthorized'], 401));
}
}
click for more Laravel codes read about laravel authentication
COMMENTS