Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Commit

Permalink
fix: Do not send authorization header with client session token
Browse files Browse the repository at this point in the history
  • Loading branch information
razor-x authored Jul 28, 2023
1 parent 62dbfb9 commit ee0fa03
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/classes/Seam.md

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

11 changes: 5 additions & 6 deletions src/seam-connect/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export class Seam extends Routes {
] = `Javascript SDK v${version}, Node.js mode, (https://github.com/seamapi/javascript)`
}
this.client = axios.create({
withCredentials: clientSessionToken ? true : false,
...axiosOptions,
baseURL: endpoint,
headers,
Expand Down Expand Up @@ -217,15 +216,15 @@ const getAuthHeaders = ({
if (!clientSessionToken.startsWith("seam_cst")) {
throw new Error("clientSessionToken must start with seam_cst")
}
return {
authorization: `Bearer ${clientSessionToken}`,
"client-session-token": clientSessionToken,
}
return { "client-session-token": clientSessionToken }
}

if (apiKey) {
if (apiKey.startsWith("seam_cst")) {
throw new Error("You can't use a Client Session Token as an apiKey.")
console.warn(
"Using API Key as Client Session Token is deprecated. Please use the clientSessionToken option instead."
)
return { "client-session-token": apiKey }
}
if (!isValueUsedForBearerAuthentication(apiKey) && workspaceId)
throw new Error(
Expand Down

0 comments on commit ee0fa03

Please sign in to comment.