mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-04-02 03:00:32 -04:00
Handle both 'Bearer ' and 'Bearer' auth headers properly
This commit is contained in:
committed by
Alec LaLonde
parent
961d53ec79
commit
14317bda46
@@ -11,7 +11,7 @@ const unauthorizedVariables = {
|
||||
function getHeaderToken(req: Request): string | null {
|
||||
const authHeader = req.headers.authorization;
|
||||
if (!authHeader) return null;
|
||||
if (authHeader.substring(0, 7) !== 'Bearer')
|
||||
if (authHeader.substring(0, 6) !== 'Bearer')
|
||||
throw new Error('invalid token type');
|
||||
|
||||
const token = authHeader.replace('Bearer', '').trim();
|
||||
|
||||
Reference in New Issue
Block a user