Skip to content

Commit ebb8bab

Browse files
authored
Je/connect sdk decouple app from token (#13870)
* WIP adding new params needed * clean things up so there are only additive changes. * bump version, fix sdk ref in test app.
1 parent 97af485 commit ebb8bab

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

packages/sdk/examples/next-app/app/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default function Home() {
2828
setApp(app)
2929
pd.connectAccount({
3030
app,
31+
oauthAppId,
3132
token,
3233
onSuccess: ({ id: authProvisionId }) => {
3334
setAuthProvisionId(authProvisionId as string)

packages/sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/sdk",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"description": "Pipedream SDK",
55
"type": "module",
66
"main": "dist/server/index.js",

packages/sdk/src/browser/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ type CreateBrowserClientOpts = {
2424
*/
2525
type AppId = string;
2626

27+
/**
28+
* A unique identifier for an oauth app.
29+
*/
30+
type OauthAppId = string;
31+
2732
/**
2833
* Object representing an app to start connecting with.
2934
*/
@@ -63,6 +68,10 @@ type StartConnectOpts = {
6368
*/
6469
app: AppId | StartConnectApp;
6570

71+
/**
72+
* The ID of the OAuth Client to connect.
73+
*/
74+
oauthAppId: OauthAppId;
6675
/**
6776
* Callback function to be called upon successful connection.
6877
*
@@ -218,6 +227,11 @@ class BrowserClient {
218227
} else {
219228
throw new ConnectError("Object app not yet supported");
220229
}
230+
if (typeof opts.oauthAppId === "string") {
231+
qp.set("oauthAppId", opts.oauthAppId);
232+
} else {
233+
throw new ConnectError("Object app not yet supported");
234+
}
221235

222236
const iframe = document.createElement("iframe");
223237
iframe.id = `pipedream-connect-iframe-${this.iframeId++}`;

0 commit comments

Comments
 (0)