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();