Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.
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
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: 6 additions & 5 deletions src/seam-connect/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ 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 @@ -216,15 +217,15 @@ const getAuthHeaders = ({
if (!clientSessionToken.startsWith("seam_cst")) {
throw new Error("clientSessionToken must start with seam_cst")
}
return { "client-session-token": clientSessionToken }
return {
authorization: `Bearer ${clientSessionToken}`,
"client-session-token": clientSessionToken,
}
}

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