Scheduling infrastructure for absolutely everyone.
fix: third part token auth strategy (#22374)
Morgan2743b32536ef
diff --git a/apps/api/v2/src/modules/auth/strategies/api-auth/api-auth.strategy.ts b/apps/api/v2/src/modules/auth/strategies/api-auth/api-auth.strategy.tsindex 17538140fd0..4afaf48af82 100644--- a/apps/api/v2/src/modules/auth/strategies/api-auth/api-auth.strategy.ts+++ b/apps/api/v2/src/modules/auth/strategies/api-auth/api-auth.strategy.ts@@ -105,12 +105,13 @@ export class ApiAuthStrategy extends PassportStrategy(BaseStrategy, "api-auth")if (thirdPartyAccessTokenAllowed && request.authMethod === AuthMethods["ACCESS_TOKEN"]) {request.authMethod = AuthMethods["THIRD_PARTY_ACCESS_TOKEN"];const result = await this.validateThirdPartyAccessToken(bearerToken, request);+if (result.success) {return this.success(this.getSuccessUser(result.data));}}// token was not third party token, rethrow error from authenticateBearerToken- if (err instanceof HttpException) {+ if (err instanceof Error) {return this.error(err);}}@@ -214,21 +215,17 @@ export class ApiAuthStrategy extends PassportStrategy(BaseStrategy, "api-auth"): await this.accessTokenStrategy(authString, request, requestOrigin);if (!user) {- return this.error(- new UnauthorizedException(- "ApiAuthStrategy - bearer token - No user associated with the provided token"- )+ throw new UnauthorizedException(+ "ApiAuthStrategy - bearer token - No user associated with the provided token");}return this.success(this.getSuccessUser(user));} catch (err) {if (err instanceof Error) {- return this.error(err);+ throw err;}- return this.error(- new InternalServerErrorException("An error occurred while authenticating the request")- );+ throw new InternalServerErrorException("An error occurred while authenticating the request");}}