Skip to content

Commit 9727a18

Browse files
Adding intial info about Connect Link
1 parent ab316a1 commit 9727a18

File tree

2 files changed

+36
-38
lines changed

2 files changed

+36
-38
lines changed

docs-v2/pages/connect/index.mdx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ import VideoPlayer from "@/components/VideoPlayer";
88
<Callout type="info">
99
**Pipedream Connect is currently in preview, and we're looking for feedback!**
1010

11-
In the preview phase,
12-
13-
- **Connect is free to use for any workspace**. [Pricing will come later](#plans-and-pricing), likely at a per-user or per-account charge.
14-
- **The API will change without notice, which may cause breaking changes**. We'll do our best to communicate these changes.
11+
**During the preview phase, Connect is free to use for any workspace. The API may change without notice, which may cause breaking changes**. We'll do our best to communicate these changes.
1512

1613
Please reach out at `[email protected]` or our [Slack community](https://pipedream.com/support) to let us know how you're using it, what's not working, and what else you'd like to see.
1714
</Callout>
@@ -27,7 +24,7 @@ Connect lets your users authorize access to any API, directly in your app. You c
2724

2825
You have full, code-level control over how these integrations work. You handle the product, Pipedream takes care of the auth. Connect provides:
2926

30-
1. A [Client SDK](https://github.com/PipedreamHQ/pipedream/tree/master/packages/sdk) to initiate authorization or accept API keys on behalf of your users, for any of the [{process.env.PUBLIC_APPS}+ APIs](https://pipedream.com/apps) available on Pipedream
27+
1. A [Client SDK](https://github.com/PipedreamHQ/pipedream/tree/master/packages/sdk) or [Connect Link](/connect/quickstart#use-connect-link) to initiate authorization or accept API keys on behalf of your users, for any of the [{process.env.PUBLIC_APPS}+ APIs](https://pipedream.com/apps) available on Pipedream
3128
2. A [REST API](/connect/api) to retrieve credentials for your end users — OAuth access tokens, API keys, and other credentials stored for them
3229
3. The Pipedream platform and its [workflow builder](/workflows), [serverless runtime](/), and thousands of no-code [triggers](/workflows/triggers) and [actions](/workflows/actions)
3330

@@ -54,8 +51,6 @@ Watch [the demo](https://www.youtube.com/embed/xhUagMsogkQ) or visit [the quicks
5451

5552
During the preview phase, **Connect is free to use for any workspace**.
5653

57-
After the preview phase, Pipedream is likely to charge on the number of end users who have active accounts in your workspace's projects. Any pricing changes will be clearly communicated, and you can delete unused end user accounts at any time.
58-
5954
Please let us know if you have any feedback on the value of Connect and how you'd like to see it priced.
6055

6156
## Security
@@ -76,9 +71,8 @@ All credentials and tokens are sent to Pipedream securely over HTTPS, and encryp
7671
## Product roadmap for Connect
7772

7873
- Address bugs and feedback during the preview phase
79-
- Simplify the developer experience and SDK integration
80-
- Invoke Pipedream workflows on behalf of end users
81-
- Support hosted UIs for connecting accounts — native support for mobile environments that can't execute JavaScript or load iframes.
74+
- Use Pipedream OAuth clients while in development, to make it easier to get started
75+
- Invoke Pipedream workflows on behalf of your end users
8276
- Improve error handling for Connect developers and end users
8377
- And more!
8478

docs-v2/pages/connect/quickstart.mdx

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ You'll need these when configuring the SDK and making API requests.
5959
You'll need to do two things to integrate Pipedream Connect into your app:
6060

6161
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.
62-
2. [Add the Pipedream SDK to your frontend](#connect-your-account-from-the-frontend). This lets you start the account connection flow for your end users.
62+
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.
6363

6464
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`.
6565

@@ -86,8 +86,8 @@ If you're building your own app, you'll need to provide these values to the envi
8686

8787
You need to secure specific operations, for example:
8888

89-
- You need to initiate the account connection flow for your end users. In Pipedream Connect, **you exchange your project keys for a short-lived token that allows a specific user to connect a specific app**, and return that token to your frontend.
90-
- If you expose your Pipedream project keys directly to the frontend, anyone could initiate the account connection flow for any user, and you'd be charged for those accounts.
89+
- You need to initiate the account connection flow for your end users. In Pipedream Connect, **you exchange your project keys for a short-lived token that allows a specific user to connect a specific app**, and return either that token or the `connect_link_url` to your frontend.
90+
- If you expose your Pipedream project keys directly to the frontend, anyone could initiate the account connection flow for any user.
9191
- You need to retrieve account credentials for your end users. Again, this should happen securely on your server, not in the frontend, to protect your users' data.
9292

9393
</Callout>
@@ -165,8 +165,6 @@ const client = new Client({
165165
});
166166

167167
const connectTokenOpts = {
168-
app_slug: "YOUR_APP_SLUG", // The app's name slug
169-
oauth_app_id: "o_abc123", // The OAuth app ID, if you're connecting an OAuth app — keep this in config / a DB, pass here
170168
external_id: "USER_ID" // The end user's ID in your system
171169
}
172170

@@ -217,8 +215,6 @@ client = Client({
217215
})
218216

219217
connect_token_opts = {
220-
'app_slug': "YOUR_APP_SLUG",
221-
'oauth_app_id': "o_abc123",
222218
'external_id': "USER_ID"
223219
}
224220

@@ -262,7 +258,7 @@ public class Client {
262258
conn.setRequestProperty("Content-Type", "application/json");
263259
conn.setDoOutput(true);
264260

265-
String jsonInputString = String.format("{\"app_slug\":\"%s\",\"oauth_app_id\":\"%s\",\"external_id\":\"%s\"}", appSlug, oauthClientId, externalId);
261+
String jsonInputString = String.format("{\"external_id\":\"%s\"}", externalId);
266262

267263
try (OutputStream os = conn.getOutputStream()) {
268264
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
@@ -276,7 +272,7 @@ public class Client {
276272
Client client = new Client("YOUR_SECRET_KEY", "YOUR_PUBLIC_KEY");
277273

278274
// Expose this code as an API endpoint in your server to fetch the token from the frontend
279-
String response = client.connectTokenCreate("YOUR_APP_SLUG", "o_abc123", "USER_ID");
275+
String response = client.connectTokenCreate("USER_ID");
280276
}
281277
}
282278

@@ -313,7 +309,7 @@ public class Client {
313309
client.DefaultRequestHeaders.Add("Authorization", auth);
314310
client.DefaultRequestHeaders.Add("Content-Type", "application/json");
315311

316-
var content = new StringContent($"{{\"app_slug\":\"{appSlug}\",\"oauth_app_id\":\"{oauthClientId}\",\"external_id\":\"{externalId}\"}}", Encoding.UTF8, "application/json");
312+
var content = new StringContent($"{{\"external_id\":\"{externalId}\"}}", Encoding.UTF8, "application/json");
317313
var response = await client.PostAsync($"{baseURL}/v1/connect/tokens", content);
318314

319315
return await response.Content.ReadAsStringAsync();
@@ -324,7 +320,7 @@ public class Client {
324320
var client = new Client("YOUR_SECRET_KEY", "YOUR_PUBLIC_KEY");
325321

326322
// Expose this code as an API endpoint in your server to fetch the token from the frontend
327-
string response = await client.ConnectTokenCreate("YOUR_APP_SLUG", "o_abc123", "USER_ID");
323+
string response = await client.ConnectTokenCreate("USER_ID");
328324
}
329325
}
330326

@@ -364,13 +360,11 @@ func (c *Client) authorizationHeader() string {
364360
return fmt.Sprintf("Basic %s", encoded)
365361
}
366362

367-
func (c *Client) ConnectTokenCreate(appSlug, oauthClientId, externalId string) (map[string]interface{}, error) {
363+
func (c *Client) ConnectTokenCreate(externalId string) (map[string]interface{}, error) {
368364
auth := c.authorizationHeader()
369365
url := fmt.Sprintf("%s/v1/connect/tokens", c.BaseURL)
370366

371367
opts := map[string]string{
372-
"app_slug": appSlug,
373-
"oauth_app_id": oauthClientId,
374368
"external_id": externalId,
375369
}
376370

@@ -405,7 +399,7 @@ func main() {
405399
client := NewClient("YOUR_SECRET_KEY", "YOUR_PUBLIC_KEY")
406400

407401
// Expose this code as an API endpoint in your server to fetch the token from the frontend
408-
response, err := client.ConnectTokenCreate("YOUR_APP_SLUG", "o_abc123", "USER_ID")
402+
response, err := client.ConnectTokenCreate("USER_ID")
409403
if err != nil {
410404
fmt.Println("Error:", err)
411405
return
@@ -441,8 +435,6 @@ class Client {
441435
$url = "$this->baseURL/v1/connect/tokens";
442436

443437
$data = json_encode([
444-
'app_slug' => $appSlug,
445-
'oauth_app_id' => $oauthClientId,
446438
'external_id' => $externalId
447439
]);
448440

@@ -468,8 +460,6 @@ class Client {
468460
$client = new Client('YOUR_SECRET_KEY', 'YOUR_PUBLIC_KEY');
469461

470462
$connectTokenOpts = [
471-
'app_slug' => "YOUR_APP_SLUG",
472-
'oauth_app_id' => "o_abc123",
473463
'external_id' => "USER_ID"
474464
];
475465

@@ -499,12 +489,12 @@ class Client
499489
"Basic #{encoded}"
500490
end
501491

502-
def connect_token_create(app_slug, oauth_app_id, external_id)
492+
def connect_token_create(external_id)
503493
uri = URI("#{@base_url}/v1/connect/tokens")
504494
req = Net::HTTP::Post.new(uri)
505495
req['Authorization'] = authorization_header
506496
req['Content-Type'] = 'application/json'
507-
req.body = { app_slug: app_slug, oauth_app_id: oauth_app_id, external_id: external_id }.to_json
497+
req.body = { external_id: external_id }.to_json
508498

509499
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
510500
http.request(req)
@@ -517,33 +507,34 @@ end
517507
client = Client.new('YOUR_SECRET_KEY', 'YOUR_PUBLIC_KEY')
518508

519509
connect_token_opts = {
520-
app_slug: "YOUR_APP_SLUG",
521-
oauth_app_id: "o_abc123",
522510
external_id: "USER_ID"
523511
}
524512

525513
# Expose this code as an API endpoint in your server to fetch the token from the frontend
526-
response = client.connect_token_create(connect_token_opts[:app_slug], connect_token_opts[:oauth_app_id], connect_token_opts[:external_id])
514+
response = client.connect_token_create(connect_token_opts[:external_id])
527515
```
528516
</Tabs.Tab>
529517
</Tabs>
530518

531-
In our Next.js app, we call the `serverConnectTokenCreate` method from the frontend to retrieve a token **for a specific user, and a specific app**.
519+
In our Next.js app, we call the `serverConnectTokenCreate` method from the frontend to retrieve a token **for a specific user**.
532520

533521
```typescript
534522
import { serverConnectTokenCreate } from "./server"
535523

536524
const { token, expires_at } = await serverConnectTokenCreate({
537-
app_slug: appSlug, // The app's name slug, passed from the frontend
538-
oauth_app_id: oauthAppId, // The OAuth app ID, if you're connecting an OAuth app — keep this in config / a DB, pass here
539525
external_id: externalUserId // The end user's ID in your system
540526
});
541527
```
542528

543529
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.
544530

545-
### Connect your account from the frontend
531+
### Connect your account
546532

533+
To actually connect an account, you have two options:
534+
1. [Use the Pipedream SDK](#use-the-pipedream-sdk-in-your-frontend) in your frontend
535+
2. [Use Connect Link](#use-connect-link) to deliver a hosted URL to your user
536+
537+
#### Use the Pipedream SDK in your frontend
547538
First, install the [Pipedream SDK](https://www.npmjs.com/package/@pipedream/sdk) in your frontend:
548539

549540
```bash
@@ -583,6 +574,19 @@ export default function Home() {
583574

584575
Press that button to connect an account for the app you configured.
585576

577+
#### Use Connect Link
578+
- Avoid any frontend implementation
579+
- 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.
580+
- Before returning the URL to your user, you'll need to include the `app` on the URL. For example, see below.
581+
- Users can open this URL in a browser window to connect their account.
582+
583+
```
584+
https://pipedream.com/_static/connect.html?token={token}&connectLink=true&app={appSlug}
585+
```
586+
587+
**To test this code, check out this workflow:**
588+
[https://pipedream.com/new?h=tch_6Lf9Dn](https://pipedream.com/new?h=tch_6Lf9Dn)
589+
586590
### Retrieve the credentials from the backend
587591

588592
Once the user connects an account, you can retrieve their credentials from your backend with your project keys.

0 commit comments

Comments
 (0)