Fix auth header check
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
|
use Log;
|
||||||
use Closure;
|
use Closure;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
||||||
@@ -21,7 +22,8 @@ class ApiAuth
|
|||||||
public function handle($request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
// Check if Authorization header is in place
|
// Check if Authorization header is in place
|
||||||
if(!$request->header('Authorization')) {
|
$auth = $request->header('Authorization', null);
|
||||||
|
if(empty($auth)) {
|
||||||
return $this->unauthorized('Authorization header missing');
|
return $this->unauthorized('Authorization header missing');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user