You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Connect Link provides a Pipedream-hosted link that lets you connect third-party accounts without any frontend implementation in your app.
4
+
5
+
## When to use Connect Link
6
+
7
+
If you aren't able to execute JavaScript or open an iFrame in your frontend, or you want to send users a URL to connect accounts via email or SMS, use Connect Link. That URL opens a Pipedream-hosted page that guides the user through the account connection flow. The URL is scoped to the specific end user, and expires after 4 hours.
8
+
9
+
## How to generate a link
10
+
11
+
See [the Connect quickstart](/connect/quickstart) for a full tutorial for getting Connect up and running.
12
+
13
+
Here's a quick overview of how to generate a Connect Link URL:
14
+
15
+
1. First, [generate a token](/connect/quickstart/#generate-a-token) for your users.
16
+
2. Extract the `connect_link_url` from the token response.
17
+
3. Before returning the URL to your user, add an `app` parameter to the end of the query string:
When you [generate a Connect link](/connect/quickstart/#how-to-generate-a-link), you can specify `success_redirect_url` and `error_redirect_url` parameters. Pipedream will redirect the end user to these URLs after they complete the connection flow, or if an error occurs. [See the API docs](/connect/api#create-a-new-token) for details.
31
+
32
+
In the absence of these URLs, Pipedream will redirect the user to a Pipedream-hosted success or error page at the end of the connection flow.
Pipedream Connect projects support two environments: `development` and `production`.
4
+
5
+
1. Connected accounts and credentials stored in `development` remain separate from `production`.
6
+
2. In `development`, you can use the official Pipedream OAuth apps, so you can test integrations without creating your own OAuth client.
7
+
8
+
## How to specify environment
9
+
10
+
You specify the environment when [creating a new Connect token](/connect/api/#create-a-new-token) with the Pipedream SDK or API. By default, the enviromment is set to `production`. When users succesfully connect their account, Pipedream saves it for that `external_user_id` in the specified `project_environment`.
When connecting an account for any OAuth app via Pipedream Connect, we'll default to using Pipedream's official OAuth client, which enables you to quickly get up and running. [Read more about OAuth clients in Pipedream here](/connected-accounts/oauth-clients).
7
+
8
+
## Using Pipedream OAuth
9
+
10
+
There are two types of apps in Pipedream:
11
+
12
+
1.**Key-based**: These apps require static credentials, like API keys. Pipedream stores these credentials securely and exposes them via API.
13
+
2.**OAuth**: These apps require OAuth authorization. Pipedream manages the OAuth flow for these apps, ensuring you always have a fresh access token for requests.
14
+
15
+
**OAuth apps require you create your own OAuth client to [deploy to production](/connect/environments):**
16
+
17
+
<Callouttype="info">
18
+
To get started in [development mode](/connect/environments), you can skip these steps. To deploy your app to production, you'll need to [create an OAuth client](#using-a-custom-oauth-client) for the app you're integrating.
19
+
</Callout>
20
+
21
+
## Using a custom OAuth client
22
+
23
+
1. Follow the steps [here](/connected-accounts/oauth-clients#configuring-custom-oauth-clients) to create an OAuth client in Pipedream.
24
+
2. Open the **Apps** tab within your Pipedream project and select **Add app**.
25
+
3. Select the app you're looking for, then select your OAuth client from the dropdown menu.
26
+
4. When connecting an account either via the [frontend SDK](/connect/quickstart#use-the-pipedream-sdk-in-your-frontend), make sure to include the `oauth_app_id` in `pd.connectAccount()`.
27
+
5. If using [Connect Link](/connect/quickstart#use-connect-link), make sure to include the `oauth_app_id` in the URL.
28
+
29
+
### Finding your OAuth app ID
30
+
31
+
[Create your OAuth client in Pipedream](https://pipedream.com/@/accounts/oauth-clients) then click the arrow to the left of the client name to expand the details.
Copy file name to clipboardExpand all lines: docs-v2/pages/connect/quickstart.mdx
+37-34Lines changed: 37 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,24 +21,10 @@ And here's the technical flow between your frontend, backend, and Pipedream's AP
21
21
22
22
<Steps>
23
23
24
-
### Add the apps you want to integrate
25
-
26
-
1. Open an existing Pipedream project or create a new one at [https://pipedream.com/projects](https://pipedream.com/projects).
27
-
2. Click the **Connect** tab, then select **Apps**.
28
-
3. From here, you can add any app to your project that you want to integrate with your application.
29
-
30
-
There are two types of apps in Pipedream:
31
-
32
-
1.**Key-based**: These apps require static credentials, like API keys. Pipedream stores these credentials securely and exposes them via API.
33
-
2.**OAuth**: These apps require OAuth authorization. Pipedream manages the OAuth flow for these apps, ensuring you always have a fresh access token for requests.
34
-
35
-
**OAuth apps require you [create your own OAuth client](#creating-a-custom-oauth-client):**
36
-
1. First, [create an OAuth client](/connected-accounts/oauth-clients#configuring-custom-oauth-clients) for the app you'd like to integrate.
37
-
2. Now when selecting an OAuth app in the **Apps** tab, you'll be prompted to select the OAuth client you've created.
38
-
39
24
### Get your project keys
40
25
41
-
1. From within the the **Connect** tab in your project, select **Configuration**.
26
+
1. Open an existing Pipedream project or create a new one at [https://pipedream.com/projects](https://pipedream.com/projects).
27
+
2. From within the the **Connect** tab in your project, select **Configuration**.
42
28
3. Find your project's **Public Key** and **Secret Key**.
43
29
44
30
You'll need these when configuring the SDK and making API requests.
@@ -47,15 +33,19 @@ You'll need these when configuring the SDK and making API requests.
47
33
48
34
<Imagesrc="https://res.cloudinary.com/pipedreamin/image/upload/v1724773559/connect-keys_cb4ujt.png"alt="Project keys in the Connect tab"width={650}height={300} />
49
35
50
-
### Run the Pipedream demo app or configure your own
36
+
### Run the Pipedream example app or configure your own
51
37
52
-
You'll need to do two things to integrate Pipedream Connect into your app:
38
+
You'll need to do two things to add Pipedream Connect to your app:
53
39
54
-
1.[Connect to the Pipedream API from your server](#connect-to-the-pipedream-api-from-your-server-and-create-a-token). This lets you make secure calls to the Pipedream API to initiate the account connection flow and retrieve account credentials. If you're running a JavaScript framework like Node.js on the server, you can use the Pipedream SDK.
55
-
2.[Add the Pipedream SDK to your frontend](#connect-your-account-from-the-frontend) or deliver a URL to your users to start the account connection flow.
40
+
1.[Connect to the Pipedream API from your server](#connect-to-the-pipedream-api-from-your-server-and-create-a-token). This lets you make secure calls to the Pipedream API to initiate the account connection flow and retrieve account credentials. If you're running a JavaScript framework like Node.js on your server, you can use the Pipedream SDK.
41
+
2.[Add the Pipedream SDK to your frontend](#connect-your-account-from-the-frontend) or redirect your users to [a Pipedream-hosted URL](/connect/connect-link) to start the account connection flow.
56
42
57
43
We'll walk through these steps below, using [an example Next.js app](https://github.com/PipedreamHQ/pipedream-connect-examples/tree/master/next-app/). To follow along, clone [the repo](https://github.com/PipedreamHQ/pipedream-connect-examples/) and follow the instructions in [the app's `README`](https://github.com/PipedreamHQ/pipedream-connect-examples/tree/master/next-app/). That will run the app on `localhost:3000`.
58
44
45
+
<Callouttype="info">
46
+
The Next.js app is just an example. You can build Connect apps in any framework, using any language. We've provided examples in Python, Ruby, and others below.
47
+
</Callout>
48
+
59
49
First, copy the `.env.example` file to `.env.local`:
If you're using a different server / API framework, you'll need to make secure calls to that API to create a new token for your users. For example, you might validate a user's session, then call the Pipedream API to create a new token for that user.
523
513
524
-
### Connect your account
514
+
<Callouttype="info">
515
+
Refer to the API docs for [all the parameters you can pass](/connect/api#create-a-new-token) in the `ConnectTokenCreate` call.
516
+
</Callout>
517
+
518
+
### Connect a user's account
519
+
520
+
To connect a third-party account for a user, you have two options:
525
521
526
-
To actually connect an account, you have two options:
527
522
1.[Use the Pipedream SDK](#use-the-pipedream-sdk-in-your-frontend) in your frontend
528
-
2.[Use Connect Link](#use-connect-link) to deliver a hosted URL to your user
523
+
2.[Use Connect Link](#use-connect-link) to deliver a hosted URL to your user (see above).
529
524
530
525
#### Use the Pipedream SDK in your frontend
526
+
527
+
Use this method when you want to handle the account connection flow yourself, in your app. For example, you might want to show a **Connect Slack** button in your app that triggers the account connection flow.
528
+
531
529
First, install the [Pipedream SDK](https://www.npmjs.com/package/@pipedream/sdk) in your frontend:
532
530
533
531
```bash
534
532
npm i --save @pipedream/sdk
535
533
```
536
534
537
-
When the user connects an account in your product, [fetch a token from your backend](#connect-to-the-pipedream-api-from-your-server-and-create-a-token) and call `connectAccount`. This opens a Pipedream iFrame that guides the user through the account connection.
535
+
When the user connects an account in your product, [pass the token from your backend](#connect-to-the-pipedream-api-from-your-server-and-create-a-token) and call `connectAccount`. This opens a Pipedream iFrame that guides the user through the account connection.
538
536
539
537
In our example, `app/page.tsx` calls the `connectAccount` method from the Pipedream SDK when the user clicks the **Connect your account** button.
540
538
@@ -549,7 +547,8 @@ export default function Home() {
549
547
const pd =createClient()
550
548
function connectAccount() {
551
549
pd.connectAccount({
552
-
app: process.env.NEXT_PUBLIC_PIPEDREAM_APP_SLUG, // From the Next.js example — adjust to pass your own app name slug
550
+
app: appSlug, // Pass the app name slug of the app you want to integrate
551
+
oauthAppId: appId, // For OAuth apps, pass the OAuth app ID; omit this param to use Pipedream's OAuth client or for key-based apps
553
552
token: "YOUR_TOKEN", // The token you received from your server above
@@ -568,17 +567,20 @@ export default function Home() {
568
567
Press that button to connect an account for the app you configured.
569
568
570
569
#### Use Connect Link
571
-
- Avoid any frontend implementation
572
-
- If you aren't able to execute JavaScript or open an iFrame in your frontend, you can use the `connect_link_url` that's returned from the `connectTokenCreate` method to deliver a URL to your users.
573
-
- Before returning the URL to your user, you'll need to include the `app` on the URL. For example, see below.
574
-
- Users can open this URL in a browser window to connect their account.
570
+
571
+
Use this option when you can't execute JavaScript or open an iFrame in your environment (e.g. mobile apps), or when you want to offload the account connection flow to Pipedream and avoid frontend work. You can also send these links via email or SMS.
572
+
573
+
The Connect Link opens a Pipedream-hosted page, guiding users through the account connection process. The URL is specific to the user and expires after 4 hours.
574
+
575
+
1. First, [generate a token](#generate-a-token) for your users.
576
+
2. Extract the `connect_link_url` from the token response.
577
+
3. Before returning the URL to your user, add an `app` parameter to the end of the query string:
When you initiate account connection for your end users, you must either:
4
+
5
+
1. Generate a secure, short-lived token scoped to the end user, or
6
+
2. Use the [Connect Link](/connect/connect-link) feature to generate a URL that guides the user through the account connection flow without any frontend work on your side.
7
+
8
+
Here, we'll show you how to generate tokens for your users and return that to your frontend, passing that to the account connection flow.
9
+
10
+
Use tokens when you want to handle the account connection flow yourself, in your app's UI. For example, you might want to show a **Connect Slack** button in your app that triggers the account connection flow for Slack, or launch the flow in a modal.
11
+
12
+
## Creating a token
13
+
14
+
See docs on [the `/tokens` endpoint](/connect/api/#create-a-new-token) to create new tokens.
15
+
16
+
## Webhooks
17
+
18
+
When you generate a token, you can specify a `webhook_uri` where Pipedream will deliver updates on the account connection flow. This is useful if you want to update your UI based on the status of the account connection flow, get a log of errors, and more.
19
+
20
+
[See the webhooks docs](/connect/webhooks) for more information.
21
+
22
+
## Tokens are scoped to end users and project environments
23
+
24
+
When you [create a new Connect token](/connect/api/#create-a-new-token), you pass an `external_user_id` and an optional `project_environment` parameter. By default, the enviromment is set to `production`.
25
+
26
+
Tokens are scoped to this user and environment. When the user successfully connects an account with that token, it will be saved for that `external_user_id` in the specified `project_environment`.
When you [generate a Connect token](/connect/quickstart/#generate-a-token), you can pass a `webhook_uri` parameter. Pipedream will send a POST request to this URL when the user completes the connection flow, or if an error occurs at any point. [See the API docs](/connect/api#create-a-new-token) for details.
4
+
5
+
## Webhook events
6
+
7
+
-`CONNECTION_SUCCESS` - Sent when the user successfully connects their account
8
+
-`CONNECTION_ERROR` - Sent when an error occurs during the connection flow
9
+
10
+
## Webhook payload
11
+
12
+
### Successful connection
13
+
14
+
Please note that user credentials are not sent in the webhook request. To retrieve credentials, use the [Connect API to fetch the account](/connect/api#retrieve-account-details-by-id) using the `account.id` provided in the webhook payload.
15
+
16
+
```json
17
+
{
18
+
"event": "CONNECTION_SUCCESS",
19
+
"connect_token": "abc123",
20
+
"environment": "production",
21
+
"connect_session_id": 123,
22
+
"account": {
23
+
"id": "apn_abc123",
24
+
"name": "My Slack workspace",
25
+
"external_id": "U123456",
26
+
"healthy": true,
27
+
"dead": false,
28
+
"app": {
29
+
"id": "app_abc123",
30
+
"name_slug": "slack",
31
+
"name": "Slack",
32
+
"auth_type": "oauth",
33
+
"description": "Slack is a channel-based messaging platform",
0 commit comments