mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 23:26:42 +00:00
Fixed credential validation
This commit is contained in:
@@ -20,7 +20,7 @@ export const validateFlyioConnectionCredentials = async (config: TFlyioConnectio
|
|||||||
const { accessToken } = config.credentials;
|
const { accessToken } = config.credentials;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await request.post(
|
const resp = await request.post<{ data: { viewer: { id: string | null; email: string } } | null }>(
|
||||||
IntegrationUrls.FLYIO_API_URL,
|
IntegrationUrls.FLYIO_API_URL,
|
||||||
{ query: "query { viewer { id email } }" },
|
{ 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) {
|
} catch (error: unknown) {
|
||||||
if (error instanceof AxiosError) {
|
if (error instanceof AxiosError) {
|
||||||
throw new BadRequestError({
|
throw new BadRequestError({
|
||||||
|
|||||||
Reference in New Issue
Block a user