From a918a0ce8d8d0270987bdbce0269e83905e2354e Mon Sep 17 00:00:00 2001 From: Gao Sun Date: Wed, 25 Aug 2021 23:40:19 +0800 Subject: [PATCH] fix(core): `bearerToken` -> `bearerTokenIdentifier` --- packages/core/src/middleware/koa-auth.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/src/middleware/koa-auth.ts b/packages/core/src/middleware/koa-auth.ts index 1ed6c599e..fdc2f863e 100644 --- a/packages/core/src/middleware/koa-auth.ts +++ b/packages/core/src/middleware/koa-auth.ts @@ -15,7 +15,7 @@ export type WithAuthContext { assert( @@ -23,13 +23,13 @@ const extractBearerTokenFromHeaders = ({ authorization }: IncomingHttpHeaders) = new RequestError({ code: 'auth.authorization_header_missing', status: 401 }) ); assert( - authorization.startsWith(bearerToken), + authorization.startsWith(bearerTokenIdentifier), new RequestError( { code: 'auth.authorization_type_not_supported', status: 401 }, - { supportedTypes: [bearerToken] } + { supportedTypes: [bearerTokenIdentifier] } ) ); - return authorization.slice(bearerToken.length + 1); + return authorization.slice(bearerTokenIdentifier.length + 1); }; const getUserIdFromRequest = async (request: Request) => {