Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

# Changelog

## [1.7.0] - 2025-07-03

### Added

- Added optional scope parameter to backendClient creation.

## [1.6.11] - 2025-07-02

### Added
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@pipedream/sdk",
"type": "module",
"version": "1.6.11",
"version": "1.7.0",
"description": "Pipedream SDK",
"main": "./dist/server.js",
"module": "./dist/server.js",
Expand Down
12 changes: 12 additions & 0 deletions packages/sdk/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ export type BackendClientOpts = {
* https://pipedream.com/docs/workflows/domains
*/
workflowDomain?: string;

/**
* OAuth scope to request when obtaining access tokens
*/
scope?: string[];
};

/**
Expand Down Expand Up @@ -197,6 +202,7 @@ export class BackendClient extends BaseClient {
};
protected override projectId: string = "";
private staticAccessToken?: string;
private scope?: string[];

/**
* Constructs a new ServerClient instance.
Expand All @@ -209,6 +215,7 @@ export class BackendClient extends BaseClient {

this.ensureValidEnvironment(opts.environment);
this.projectId = opts.projectId;
this.scope = opts.scope;
if ("accessToken" in opts.credentials) {
this.staticAccessToken = opts.credentials.accessToken;
} else {
Expand Down Expand Up @@ -294,6 +301,11 @@ export class BackendClient extends BaseClient {
}

const parameters = new URLSearchParams();
if (this.scope && this.scope.length > 0) {
parameters.set("scope", this.scope.join(" "));
}
parameters.set("project_id", this.projectId);
parameters.set("environment", this.environment);
try {
const response = await oauth.clientCredentialsGrantRequest(as, client, clientAuth, parameters);
const oauthTokenResponse = await oauth.processClientCredentialsResponse(as, client, response);
Expand Down
6 changes: 2 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading