curl --request POST \
--url https://api.pipedream.com/v1/connect/{project_id}/tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-pd-environment: <x-pd-environment>' \
--data '
{
"external_user_id": "<string>",
"allowed_origins": [
"<string>"
],
"error_redirect_uri": "<string>",
"expires_in": 123,
"scope": "<string>",
"success_redirect_uri": "<string>",
"webhook_uri": "<string>",
"allow_progressive_scopes": false,
"app_id": "<string>",
"oauth_app_id": "<string>"
}
'import { PipedreamClient } from "@pipedream/sdk";
const client = new PipedreamClient({
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
projectEnvironment: "YOUR_PROJECT_ENVIRONMENT",
projectId: "YOUR_PROJECT_ID"
});
await client.tokens.create({
externalUserId: "external_user_id"
});
from pipedream import Pipedream
client = Pipedream(
project_id="YOUR_PROJECT_ID",
client_id="YOUR_CLIENT_ID",
client_secret="YOUR_CLIENT_SECRET",
)
client.tokens.create(
external_user_id="external_user_id",
)
package com.example.usage;
import com.pipedream.api.BaseClient;
import com.pipedream.api.resources.tokens.requests.CreateTokenOpts;
public class Example {
public static void main(String[] args) {
BaseClient client = BaseClient.withCredentials("<clientId>", "<clientSecret>")
.projectId("YOUR_PROJECT_ID")
.build()
;
client.tokens().create(
CreateTokenOpts
.builder()
.externalUserId("external_user_id")
.build()
);
}
}
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pipedream.com/v1/connect/{project_id}/tokens"
payload := strings.NewReader("{\n \"external_user_id\": \"<string>\",\n \"allowed_origins\": [\n \"<string>\"\n ],\n \"error_redirect_uri\": \"<string>\",\n \"expires_in\": 123,\n \"scope\": \"<string>\",\n \"success_redirect_uri\": \"<string>\",\n \"webhook_uri\": \"<string>\",\n \"allow_progressive_scopes\": false,\n \"app_id\": \"<string>\",\n \"oauth_app_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-pd-environment", "<x-pd-environment>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"connect_link_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"token": "<string>"
}{
"error": "Throttled"
}Create Connect token
Create a Connect token for a user
curl --request POST \
--url https://api.pipedream.com/v1/connect/{project_id}/tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-pd-environment: <x-pd-environment>' \
--data '
{
"external_user_id": "<string>",
"allowed_origins": [
"<string>"
],
"error_redirect_uri": "<string>",
"expires_in": 123,
"scope": "<string>",
"success_redirect_uri": "<string>",
"webhook_uri": "<string>",
"allow_progressive_scopes": false,
"app_id": "<string>",
"oauth_app_id": "<string>"
}
'import { PipedreamClient } from "@pipedream/sdk";
const client = new PipedreamClient({
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
projectEnvironment: "YOUR_PROJECT_ENVIRONMENT",
projectId: "YOUR_PROJECT_ID"
});
await client.tokens.create({
externalUserId: "external_user_id"
});
from pipedream import Pipedream
client = Pipedream(
project_id="YOUR_PROJECT_ID",
client_id="YOUR_CLIENT_ID",
client_secret="YOUR_CLIENT_SECRET",
)
client.tokens.create(
external_user_id="external_user_id",
)
package com.example.usage;
import com.pipedream.api.BaseClient;
import com.pipedream.api.resources.tokens.requests.CreateTokenOpts;
public class Example {
public static void main(String[] args) {
BaseClient client = BaseClient.withCredentials("<clientId>", "<clientSecret>")
.projectId("YOUR_PROJECT_ID")
.build()
;
client.tokens().create(
CreateTokenOpts
.builder()
.externalUserId("external_user_id")
.build()
);
}
}
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pipedream.com/v1/connect/{project_id}/tokens"
payload := strings.NewReader("{\n \"external_user_id\": \"<string>\",\n \"allowed_origins\": [\n \"<string>\"\n ],\n \"error_redirect_uri\": \"<string>\",\n \"expires_in\": 123,\n \"scope\": \"<string>\",\n \"success_redirect_uri\": \"<string>\",\n \"webhook_uri\": \"<string>\",\n \"allow_progressive_scopes\": false,\n \"app_id\": \"<string>\",\n \"oauth_app_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-pd-environment", "<x-pd-environment>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"connect_link_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"token": "<string>"
}{
"error": "Throttled"
}{
"allowed_origins": ["https://myapp.com"]
}
Authorizations
A short-lived OAuth access token for server-side requests. Generate one via the Generate OAuth Token flow or automatically when initializing the SDK client.
Headers
The environment in which the server client is running
development, production Path Parameters
The project ID, which starts with proj_.
^proj_[a-zA-Z0-9]+$Body
Request object for creating a connect token
Your end user ID, for whom you're creating the token
List of allowed origins for CORS
URI to redirect to on error
Token TTL in seconds (max 14400 = 4 hours). Defaults to 4 hours if not specified.
Space-separated scopes to restrict token permissions. Defaults to 'connect:*' if not specified. See https://pipedream.com/docs/connect/api-reference/authentication#connect-token-scopes for more information.
URI to redirect to on success
Webhook URI for notifications
When true, end users may authorize a subset of the app's OAuth scopes; only the app's functional scopes (needed for the post-OAuth test request) are enforced. Defaults to false.
Scope the Connect Link to this app, identified by app ID or name slug: resolves the app's official OAuth client for your workspace (when it has one) and pins the link to the host serving that client's OAuth flow pages. Optional.
Scope the Connect Link to a specific OAuth client (overrides app_id's resolution). Optional.
Response
connect token created
Was this page helpful?

