From 73147567905d6d6fb41d2055e799295934efa850 Mon Sep 17 00:00:00 2001 From: Lucemans Date: Sat, 1 Jan 2022 12:46:45 +0100 Subject: [PATCH] Update Bearer Validation --- src/auth/useAuth.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/auth/useAuth.ts b/src/auth/useAuth.ts index 99d9c9ef..51721ec7 100644 --- a/src/auth/useAuth.ts +++ b/src/auth/useAuth.ts @@ -16,12 +16,10 @@ export const useAuth: RequestHandler = NextHandler( if (!request.headers.authorization) return NoPermission(); let auth = request.headers.authorization; - if (auth.toLowerCase().startsWith('Bearer ')) { - auth = auth.slice(0, Math.max(0, 'Bearer '.length)); + if (auth.toLowerCase().startsWith('bearer ')) { + auth = auth.slice('Bearer '.length); } - log.debug('Validating ' + auth); - const decoded = decode(auth) as { account: string; value: number }; if (!decoded) return NoPermission();