diff --git a/src/middleware/bearer-auth/index.test.ts b/src/middleware/bearer-auth/index.test.ts index 8c017f48..4dca87f2 100644 --- a/src/middleware/bearer-auth/index.test.ts +++ b/src/middleware/bearer-auth/index.test.ts @@ -126,7 +126,7 @@ describe('Bearer Auth by Middleware', () => { '/auth-custom-invalid-authentication-header-message-string/*', bearerAuth({ token, - invalidAuthenticationHeaderMeasage: + invalidAuthenticationHeaderMessage: 'Custom invalid authentication header message as string', }) ) @@ -139,7 +139,7 @@ describe('Bearer Auth by Middleware', () => { '/auth-custom-invalid-authentication-header-message-object/*', bearerAuth({ token, - invalidAuthenticationHeaderMeasage: { + invalidAuthenticationHeaderMessage: { message: 'Custom invalid authentication header message as object', }, }) @@ -153,7 +153,7 @@ describe('Bearer Auth by Middleware', () => { '/auth-custom-invalid-authentication-header-message-function-string/*', bearerAuth({ token, - invalidAuthenticationHeaderMeasage: () => + invalidAuthenticationHeaderMessage: () => 'Custom invalid authentication header message as function string', }) ) @@ -166,7 +166,7 @@ describe('Bearer Auth by Middleware', () => { '/auth-custom-invalid-authentication-header-message-function-object/*', bearerAuth({ token, - invalidAuthenticationHeaderMeasage: () => ({ + invalidAuthenticationHeaderMessage: () => ({ message: 'Custom invalid authentication header message as function object', }), }) diff --git a/src/middleware/bearer-auth/index.ts b/src/middleware/bearer-auth/index.ts index a8db32f4..0e86d4d4 100644 --- a/src/middleware/bearer-auth/index.ts +++ b/src/middleware/bearer-auth/index.ts @@ -23,7 +23,7 @@ type BearerAuthOptions = headerName?: string hashFunction?: Function noAuthenticationHeaderMessage?: string | object | MessageFunction - invalidAuthenticationHeaderMeasage?: string | object | MessageFunction + invalidAuthenticationHeaderMessage?: string | object | MessageFunction invalidTokenMessage?: string | object | MessageFunction } | { @@ -33,7 +33,7 @@ type BearerAuthOptions = verifyToken: (token: string, c: Context) => boolean | Promise hashFunction?: Function noAuthenticationHeaderMessage?: string | object | MessageFunction - invalidAuthenticationHeaderMeasage?: string | object | MessageFunction + invalidAuthenticationHeaderMessage?: string | object | MessageFunction invalidTokenMessage?: string | object | MessageFunction } @@ -127,7 +127,7 @@ export const bearerAuth = (options: BearerAuthOptions): MiddlewareHandler => { c, 400, `${wwwAuthenticatePrefix}error="invalid_request"`, - options.invalidAuthenticationHeaderMeasage || 'Bad Request' + options.invalidAuthenticationHeaderMessage || 'Bad Request' ) } else { let equal = false