Skip to content

Commit

Permalink
Je/connect sdk decouple app from token (#13870)
Browse files Browse the repository at this point in the history
* WIP adding new params needed

* clean things up so there are only additive changes.

* bump version, fix sdk ref in test app.
  • Loading branch information
jsendo authored Sep 9, 2024
1 parent 97af485 commit ebb8bab
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/sdk/examples/next-app/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default function Home() {
setApp(app)
pd.connectAccount({
app,
oauthAppId,
token,
onSuccess: ({ id: authProvisionId }) => {
setAuthProvisionId(authProvisionId as string)
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
14 changes: 14 additions & 0 deletions packages/sdk/src/browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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++}`;
Expand Down

0 comments on commit ebb8bab

Please sign in to comment.