diff --git a/apps/api/src/app/auth/api-key.strategy.ts b/apps/api/src/app/auth/api-key.strategy.ts index e1e067ab7..a88c8d8f9 100644 --- a/apps/api/src/app/auth/api-key.strategy.ts +++ b/apps/api/src/app/auth/api-key.strategy.ts @@ -21,13 +21,10 @@ export class ApiKeyStrategy extends PassportStrategy( private readonly prismaService: PrismaService, private readonly userService: UserService ) { - super({ header: HEADER_KEY_TOKEN, prefix: 'Api-Key ' }, true); + super({ header: HEADER_KEY_TOKEN, prefix: 'Api-Key ' }, false); } - public async validate( - apiKey: string, - done: (error: any, user?: any) => void - ) { + public async validate(apiKey: string): Promise { try { const user = await this.validateApiKey(apiKey); @@ -49,9 +46,9 @@ export class ApiKeyStrategy extends PassportStrategy( }); } - done(null, user); + return user; } catch (error) { - done(error, null); + throw error; } }