I am using AuthBasic for APIauthentication in a Laravel project, I have this problem : when the API request authentication is invalid instead of displaying the json response it return the 401 default blade view template.
here is the cod:
app\Http\Middleware\AuthBasic.php
public function handle($request, Closure $next)
{
if (Auth::onceBasic()) {
return response()->json(["message", "Authentication Required!"], 401);
} else {
return $next($request);
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire