Skip to content

Commit e53351b

Browse files
Adding support for custom OAuth in connect-react (#17902)
* Custom OAuth clients * Update pnpm-lock.yaml * Update ControlApp.tsx * Update README.md * Updating refs to oauth_apps
1 parent aa09fba commit e53351b

File tree

7 files changed

+62
-9
lines changed

7 files changed

+62
-9
lines changed

packages/connect-react/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
# Changelog
44

5+
## [1.4.0] - 2025-08-01
6+
7+
### Added
8+
9+
- Support for using custom OAuth clients
10+
511
## [1.3.3] - 2025-07-22
612

713
- Improved handling and sanitization of option objects in selection components.

packages/connect-react/README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,36 @@ type ComponentFormProps = {
153153
sdkResponse: unknown[] | unknown | undefined;
154154
/** Whether to show show errors in the form. Requires sdkErrors to be set. */
155155
enableDebugging?: boolean;
156+
/** OAuth app ID configuration for specific apps.
157+
* Maps app name slugs to their corresponding OAuth app IDs. */
158+
oauthAppConfig?: Record<string, string>;
156159
};
157160
```
158161
162+
### OAuth App Configuration
163+
164+
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:
165+
166+
```tsx
167+
const oauthAppConfig = {
168+
github: "oa_xxxxxxx",
169+
google_sheets: "oa_xxxxxxx",
170+
slack: "oa_xxxxxxx",
171+
};
172+
173+
<ComponentFormContainer
174+
userId={userId}
175+
componentKey="slack-send-message-to-channel"
176+
configuredProps={configuredProps}
177+
onUpdateConfiguredProps={setConfiguredProps}
178+
oauthAppConfig={oauthAppConfig}
179+
/>;
180+
```
181+
182+
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).
183+
184+
**Note**: OAuth app IDs are not sensitive, and are safe to expose in the client.
185+
159186
## Customization
160187
161188
Style individual components using the `CustomizeProvider` and a `CustomizationConfig`.
@@ -164,7 +191,7 @@ Style individual components using the `CustomizeProvider` and a `CustomizationCo
164191
<FrontendClientProvider client={client}>
165192
<CustomizeProvider {...customizationConfig}>
166193
<ComponentFormContainer
167-
key="slack-send-message"
194+
key="slack-send-message-to-channel"
168195
configuredProps={configuredProps}
169196
onUpdateConfiguredProps={setConfiguredProps}
170197
/>

packages/connect-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/connect-react",
3-
"version": "1.3.3",
3+
"version": "1.4.0",
44
"description": "Pipedream Connect library for React",
55
"files": [
66
"dist"

packages/connect-react/src/components/ComponentForm.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ export type ComponentFormProps<T extends ConfigurableProps, U = ConfiguredProps<
2929
hideOptionalProps?: boolean;
3030
sdkResponse?: unknown | undefined;
3131
enableDebugging?: boolean;
32+
/**
33+
* OAuth app ID configuration for specific apps.
34+
* Maps app name slugs to their corresponding OAuth app IDs.
35+
* Example: { 'github': 'oa_xxxxxxx', 'google_sheets': 'oa_xxxxxxx' }
36+
*/
37+
oauthAppConfig?: Record<string, string>;
3238
} & (
3339
| { externalUserId: string; userId?: never }
3440
| { userId: string; externalUserId?: never }

packages/connect-react/src/components/ControlApp.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ type ControlAppProps = {
2929

3030
export function ControlApp({ app }: ControlAppProps) {
3131
const client = useFrontendClient();
32-
const { externalUserId } = useFormContext();
32+
const {
33+
externalUserId, oauthAppConfig,
34+
} = useFormContext();
3335
const formFieldCtx = useFormFieldContext<ConfigurablePropApp>();
3436
const {
3537
id, prop, value, onChange,
@@ -67,7 +69,7 @@ export function ControlApp({ app }: ControlAppProps) {
6769
};
6870
const selectProps = select.getProps("controlAppSelect", baseSelectProps);
6971

70-
const oauthAppId = undefined; // XXX allow customizing
72+
const oauthAppId = oauthAppConfig?.[app.name_slug];
7173
const {
7274
isLoading: isLoadingAccounts,
7375
// TODO error

packages/connect-react/src/hooks/form-context.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export type FormContext<T extends ConfigurableProps> = {
4444
/** @deprecated Use externalUserId instead */
4545
userId: string;
4646
enableDebugging?: boolean;
47+
oauthAppConfig?: Record<string, string>;
4748
};
4849

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

8384
const {
84-
component, configuredProps: __configuredProps, propNames, externalUserId, userId, sdkResponse, enableDebugging,
85+
component, configuredProps: __configuredProps, propNames, externalUserId, userId, sdkResponse, enableDebugging, oauthAppConfig,
8586
} = formProps;
8687

8788
// Resolve user ID with deprecation warning
@@ -594,6 +595,7 @@ export const FormContextProvider = <T extends ConfigurableProps>({
594595
submitting,
595596
sdkErrors,
596597
enableDebugging,
598+
oauthAppConfig,
597599
};
598600
return <FormContext.Provider value={value}>{children}</FormContext.Provider>;
599601
};

pnpm-lock.yaml

Lines changed: 14 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)