Skip to content

Commit

Permalink
fix(UI-1260): fix custom OAuth GitHub connection
Browse files Browse the repository at this point in the history
  • Loading branch information
J1za authored and RonenMars committed Jan 30, 2025
1 parent 042bbf0 commit 167aa61
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,12 @@ export const CustomOauthForm = ({
/>
<ErrorMessage>{errors.app_id?.message as string}</ErrorMessage>
</div>
<div className="relative">
<Input
{...register("webhook_secret")}
aria-label={t("github.placeholders.webhookSercet")}
isError={!!errors.webhook_secret}
isRequired
label={t("github.placeholders.webhookSercet")}
value={webhookSecret}
/>
<ErrorMessage>{errors.webhook_secret?.message as string}</ErrorMessage>
</div>
<Input
{...register("webhook_secret")}
aria-label={t("github.placeholders.webhookSercet")}
label={t("github.placeholders.webhookSercet")}
value={webhookSecret}
/>
<Input
{...register("enterprise_url")}
aria-label={t("github.placeholders.enterpriseUrl")}
Expand Down
4 changes: 2 additions & 2 deletions src/constants/lists/connections/options.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const integrationIcons: Record<string, React.ComponentType<React.SVGProps
);

export const githubIntegrationAuthMethods: SelectOption[] = [
{ label: "Default app", value: ConnectionAuthType.Oauth },
{ label: "Custom App", value: ConnectionAuthType.CustomOAuth },
{ label: "OAuth v2 - Default app", value: ConnectionAuthType.Oauth },
{ label: "OAuth v2 - Custom app", value: ConnectionAuthType.CustomOAuth },
{ label: "PAT + Webhook", value: ConnectionAuthType.Pat },
];

Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useConnectionForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,13 @@ export const useConnectionForm = (validationSchema: ZodObject<ZodRawShape>, mode
const handleCustomOauth = async (
oauthConnectionId: string,
integrationName: keyof typeof Integrations | typeof defaultGoogleConnectionName,
authType?: ConnectionAuthType.CustomOAuth | ConnectionAuthType.Oauth
authType: ConnectionAuthType.CustomOAuth | ConnectionAuthType.Oauth = ConnectionAuthType.Oauth
) => {
setIsLoading(true);
try {
await VariablesService.setByConnectiontId(oauthConnectionId, {
name: "auth_type",
value: authType || ConnectionAuthType.Oauth,
value: authType,
isSecret: false,
scopeId: oauthConnectionId,
});
Expand Down
2 changes: 1 addition & 1 deletion src/validations/connection.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const githubCustomAuthIntegrationSchema = z.object({
client_id: z.string().min(1, "Client ID is required"),
client_secret: z.string().min(1, "Client Secret is required"),
app_id: z.string().min(1, "App ID is required"),
webhook_secret: z.string().min(1, "Webhook Secret is required"),
webhook_secret: z.string(),
private_key: z.string().min(1, "Private Key is required"),
});

Expand Down

0 comments on commit 167aa61

Please sign in to comment.