Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/connect-react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

# Changelog

## [1.4.0] - 2025-08-01

### Added

- Support for using custom OAuth clients

## [1.3.3] - 2025-07-22

- Improved handling and sanitization of option objects in selection components.
Expand Down
25 changes: 25 additions & 0 deletions packages/connect-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,34 @@ type ComponentFormProps = {
sdkResponse: unknown[] | unknown | undefined;
/** Whether to show show errors in the form. Requires sdkErrors to be set. */
enableDebugging?: boolean;
/** OAuth app ID configuration for specific apps.
* Maps app name slugs to their corresponding OAuth app IDs. */
oauthAppConfig?: Record<string, string>;
};
```

### OAuth App Configuration

To connect to an OAuth app using your own OAuth client, you can specify custom OAuth app IDs for each app using the `oauthAppConfig` prop:

```tsx
const oauthAppConfig = {
github: "oa_abc123",
google_sheets: "oa_def456",
slack: "oa_ghi789",
};

<ComponentFormContainer
userId={userId}
componentKey="github-create-issue"
configuredProps={configuredProps}
onUpdateConfiguredProps={setConfiguredProps}
oauthAppConfig={oauthAppConfig}
/>;
```

This allows you to use your own OAuth applications for specific integrations, providing better control over branding and permissions. Read how to configure OAuth clients in Pipedream here: [https://pipedream.com/docs/connect/managed-auth/oauth-clients](https://pipedream.com/docs/connect/managed-auth/oauth-clients).

## Customization

Style individual components using the `CustomizeProvider` and a `CustomizationConfig`.
Expand Down
2 changes: 1 addition & 1 deletion packages/connect-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/connect-react",
"version": "1.3.3",
"version": "1.4.0",
"description": "Pipedream Connect library for React",
"files": [
"dist"
Expand Down
6 changes: 6 additions & 0 deletions packages/connect-react/src/components/ComponentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ export type ComponentFormProps<T extends ConfigurableProps, U = ConfiguredProps<
hideOptionalProps?: boolean;
sdkResponse?: unknown | undefined;
enableDebugging?: boolean;
/**
* OAuth app ID configuration for specific apps.
* Maps app name slugs to their corresponding OAuth app IDs.
* Example: { 'github': 'oauth_app_123', 'google_sheets': 'oauth_app_456' }
*/
oauthAppConfig?: Record<string, string>;
} & (
| { externalUserId: string; userId?: never }
| { userId: string; externalUserId?: never }
Expand Down
4 changes: 2 additions & 2 deletions packages/connect-react/src/components/ControlApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

export function ControlApp({ app }: ControlAppProps) {
const client = useFrontendClient();
const { externalUserId } = useFormContext();
const { externalUserId, oauthAppConfig } = useFormContext();

Check failure on line 32 in packages/connect-react/src/components/ControlApp.tsx

View workflow job for this annotation

GitHub Actions / Lint Code Base

Expected a line break before this closing brace

Check failure on line 32 in packages/connect-react/src/components/ControlApp.tsx

View workflow job for this annotation

GitHub Actions / Lint Code Base

Expected a line break after this opening brace
const formFieldCtx = useFormFieldContext<ConfigurablePropApp>();
const {
id, prop, value, onChange,
Expand Down Expand Up @@ -67,7 +67,7 @@
};
const selectProps = select.getProps("controlAppSelect", baseSelectProps);

const oauthAppId = undefined; // XXX allow customizing
const oauthAppId = oauthAppConfig?.[app.name_slug];
const {
isLoading: isLoadingAccounts,
// TODO error
Expand Down
4 changes: 3 additions & 1 deletion packages/connect-react/src/hooks/form-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export type FormContext<T extends ConfigurableProps> = {
/** @deprecated Use externalUserId instead */
userId: string;
enableDebugging?: boolean;
oauthAppConfig?: Record<string, string>;
};

export const skippablePropTypes = [
Expand Down Expand Up @@ -81,7 +82,7 @@ export const FormContextProvider = <T extends ConfigurableProps>({
const id = useId();

const {
component, configuredProps: __configuredProps, propNames, externalUserId, userId, sdkResponse, enableDebugging,
component, configuredProps: __configuredProps, propNames, externalUserId, userId, sdkResponse, enableDebugging, oauthAppConfig,
} = formProps;

// Resolve user ID with deprecation warning
Expand Down Expand Up @@ -594,6 +595,7 @@ export const FormContextProvider = <T extends ConfigurableProps>({
submitting,
sdkErrors,
enableDebugging,
oauthAppConfig,
};
return <FormContext.Provider value={value}>{children}</FormContext.Provider>;
};
18 changes: 14 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading