From 741e0ec78f0ebb74e01f5f2431005b3a976eadd6 Mon Sep 17 00:00:00 2001 From: x032205 Date: Tue, 17 Jun 2025 16:18:35 -0400 Subject: [PATCH] Fixed credential validation --- .../services/app-connection/flyio/flyio-connection-fns.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/src/services/app-connection/flyio/flyio-connection-fns.ts b/backend/src/services/app-connection/flyio/flyio-connection-fns.ts index 9e2aed626..56d4c0b31 100644 --- a/backend/src/services/app-connection/flyio/flyio-connection-fns.ts +++ b/backend/src/services/app-connection/flyio/flyio-connection-fns.ts @@ -20,7 +20,7 @@ export const validateFlyioConnectionCredentials = async (config: TFlyioConnectio const { accessToken } = config.credentials; try { - await request.post( + const resp = await request.post<{ data: { viewer: { id: string | null; email: string } } | null }>( IntegrationUrls.FLYIO_API_URL, { query: "query { viewer { id email } }" }, { @@ -30,6 +30,12 @@ export const validateFlyioConnectionCredentials = async (config: TFlyioConnectio } } ); + + if (resp.data.data === null) { + throw new BadRequestError({ + message: "Unable to validate connection: Invalid access token provided." + }); + } } catch (error: unknown) { if (error instanceof AxiosError) { throw new BadRequestError({