Skip to content

Commit 87d8d86

Browse files
committed
Forcing OAuth for invoking workflows for external users
1 parent 4385093 commit 87d8d86

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/sdk/src/server/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,7 @@ export class ServerClient {
773773
* @param opts.headers - The headers to include in the request. Note that the
774774
* Authorization header will always be set with an OAuth access token
775775
* retrieved by the client.
776+
* @param authType - The type of authorization to use for the request.
776777
*
777778
* @returns A promise resolving to the response from the workflow.
778779
*
@@ -869,8 +870,8 @@ export class ServerClient {
869870
throw new Error("External user ID is required");
870871
}
871872

872-
if (!this.publicKey) {
873-
throw new Error("Project public key is required to map the external user ID to the correct project");
873+
if (!this.oauthClient) {
874+
throw new Error("OAuth is required for invoking workflows for external users. Please pass credentials for a valid OAuth client");
874875
}
875876

876877
return this.invokeWorkflow(url, {
@@ -879,6 +880,6 @@ export class ServerClient {
879880
...headers,
880881
"X-PD-External-User-ID": externalUserId,
881882
},
882-
});
883+
}, HTTPAuthType.OAuth); // OAuth auth is required for invoking workflows for external users
883884
}
884885
}

0 commit comments

Comments
 (0)