diff --git a/packages/sdk/examples/next-app/app/page.tsx b/packages/sdk/examples/next-app/app/page.tsx index 1c36f9de1e87f..8ba93e9b84f03 100644 --- a/packages/sdk/examples/next-app/app/page.tsx +++ b/packages/sdk/examples/next-app/app/page.tsx @@ -28,6 +28,7 @@ export default function Home() { setApp(app) pd.connectAccount({ app, + oauthAppId, token, onSuccess: ({ id: authProvisionId }) => { setAuthProvisionId(authProvisionId as string) diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 12f92b3101873..57fae5020d50b 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/sdk", - "version": "0.0.8", + "version": "0.0.9", "description": "Pipedream SDK", "type": "module", "main": "dist/server/index.js", diff --git a/packages/sdk/src/browser/index.ts b/packages/sdk/src/browser/index.ts index a64c0985c8223..a8a27f1f5064f 100644 --- a/packages/sdk/src/browser/index.ts +++ b/packages/sdk/src/browser/index.ts @@ -24,6 +24,11 @@ type CreateBrowserClientOpts = { */ type AppId = string; +/** + * A unique identifier for an oauth app. + */ +type OauthAppId = string; + /** * Object representing an app to start connecting with. */ @@ -63,6 +68,10 @@ type StartConnectOpts = { */ app: AppId | StartConnectApp; + /** + * The ID of the OAuth Client to connect. + */ + oauthAppId: OauthAppId; /** * Callback function to be called upon successful connection. * @@ -218,6 +227,11 @@ class BrowserClient { } else { throw new ConnectError("Object app not yet supported"); } + if (typeof opts.oauthAppId === "string") { + qp.set("oauthAppId", opts.oauthAppId); + } else { + throw new ConnectError("Object app not yet supported"); + } const iframe = document.createElement("iframe"); iframe.id = `pipedream-connect-iframe-${this.iframeId++}`;