curl --request POST \
--url https://api.pipedream.com/v1/oauth/token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"grant_type": "client_credentials",
"client_id": "<string>",
"client_secret": "<string>",
"client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
"client_assertion": "<string>",
"scope": "<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.oauthTokens.create({
clientId: "client_id",
clientSecret: "client_secret"
});
from pipedream import Pipedream
client = Pipedream(
project_id="YOUR_PROJECT_ID",
client_id="YOUR_CLIENT_ID",
client_secret="YOUR_CLIENT_SECRET",
)
client.oauth_tokens.create(
client_id="client_id",
client_secret="client_secret",
)
package com.example.usage;
import com.pipedream.api.BaseClient;
import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts;
public class Example {
public static void main(String[] args) {
BaseClient client = BaseClient.withCredentials("<clientId>", "<clientSecret>")
.build()
;
client.oauthTokens().create(
CreateOAuthTokenOpts
.builder()
.clientId("client_id")
.clientSecret("client_secret")
.build()
);
}
}
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pipedream.com/v1/oauth/token"
payload := strings.NewReader("{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"client_assertion_type\": \"urn:ietf:params:oauth:client-assertion-type:jwt-bearer\",\n \"client_assertion\": \"<string>\",\n \"scope\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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))
}{
"access_token": "<string>",
"token_type": "<string>",
"expires_in": 123
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "Throttled"
}Generate OAuth Token
Learn how to generate an OAuth access token to authenticate requests to the Pipedream API
curl --request POST \
--url https://api.pipedream.com/v1/oauth/token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"grant_type": "client_credentials",
"client_id": "<string>",
"client_secret": "<string>",
"client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
"client_assertion": "<string>",
"scope": "<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.oauthTokens.create({
clientId: "client_id",
clientSecret: "client_secret"
});
from pipedream import Pipedream
client = Pipedream(
project_id="YOUR_PROJECT_ID",
client_id="YOUR_CLIENT_ID",
client_secret="YOUR_CLIENT_SECRET",
)
client.oauth_tokens.create(
client_id="client_id",
client_secret="client_secret",
)
package com.example.usage;
import com.pipedream.api.BaseClient;
import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts;
public class Example {
public static void main(String[] args) {
BaseClient client = BaseClient.withCredentials("<clientId>", "<clientSecret>")
.build()
;
client.oauthTokens().create(
CreateOAuthTokenOpts
.builder()
.clientId("client_id")
.clientSecret("client_secret")
.build()
);
}
}
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pipedream.com/v1/oauth/token"
payload := strings.NewReader("{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"client_assertion_type\": \"urn:ietf:params:oauth:client-assertion-type:jwt-bearer\",\n \"client_assertion\": \"<string>\",\n \"scope\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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))
}{
"access_token": "<string>",
"token_type": "<string>",
"expires_in": 123
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "Throttled"
}- Visit the API settings for your Pipedream workspace.
- Click the New OAuth Client button.
- Name your client and click Create.
- Copy the client secret. It will not be accessible again. Click Close.
- Copy the client ID from the list.
Authenticating with a public key
Clients that authenticate with a public key don’t sendclient_secret. Instead, they send a JWT signed with their private key as client_assertion, with client_assertion_type set to urn:ietf:params:oauth:client-assertion-type:jwt-bearer:
curl -X POST https://api.pipedream.com/v1/oauth/token \
-d grant_type=client_credentials \
-d client_id=YOUR_CLIENT_ID \
-d client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer \
-d client_assertion=YOUR_SIGNED_JWT
OAuth scopes
You can optionally specify ascope parameter in the request body to limit the access token to specific operations. The scope parameter accepts a space-separated list of scopes.
If no scope is specified, the token defaults to * (full access).
Example request with scopes:
curl -X POST https://api.pipedream.com/v1/oauth/token \
-H 'Content-Type: application/json' \
-d '{
"grant_type": "client_credentials",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"scope": "connect:accounts:read connect:accounts:write"
}'
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Request object for creating an OAuth token. Authenticate the client with either client_secret, or client_assertion_type and client_assertion (private_key_jwt, for clients that authenticate with a public key). Don't send both.
client_credentials The client secret, for clients that authenticate with a client secret.
Required with client_assertion.
urn:ietf:params:oauth:client-assertion-type:jwt-bearer For clients that authenticate with a public key: a JWT signed with the client's private key (ES256 or RS256). Claims: iss and sub set to the client ID, aud set to https://api.pipedream.com, exp at most 1 hour ahead, and a unique jti. Sign a new assertion for every request, including retries.
Optional space-separated scopes for the access token. Defaults to *.
Was this page helpful?

