diff --git a/app/Http/Middleware/HeaderAuth.php b/app/Http/Middleware/HeaderAuth.php index 3f8d2d3..4fbcd9d 100644 --- a/app/Http/Middleware/HeaderAuth.php +++ b/app/Http/Middleware/HeaderAuth.php @@ -15,6 +15,10 @@ class HeaderAuth */ public function handle(Request $request, Closure $next): Response { + if (! $request->hasHeader('X-BOTAUTH')) { + return response() + ->json(["status" => false, "message" => "Unauthorized."], 401); + } if (!hash_equals(config('bot.header_auth'), $request->header('X-BOTAUTH'))) { return response('Unauthorized', 401); }