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

Commit d21b192

Browse files
authored
fix: Use authorization header with client session token (#253)
1 parent 81de849 commit d21b192

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

docs/classes/Seam.md

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/seam-connect/client.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export class Seam extends Routes {
9393
] = `Javascript SDK v${version}, Node.js mode, (https://github.com/seamapi/javascript)`
9494
}
9595
this.client = axios.create({
96+
withCredentials: clientSessionToken ? true : false,
9697
...axiosOptions,
9798
baseURL: endpoint,
9899
headers,
@@ -216,15 +217,15 @@ const getAuthHeaders = ({
216217
if (!clientSessionToken.startsWith("seam_cst")) {
217218
throw new Error("clientSessionToken must start with seam_cst")
218219
}
219-
return { "client-session-token": clientSessionToken }
220+
return {
221+
authorization: `Bearer ${clientSessionToken}`,
222+
"client-session-token": clientSessionToken,
223+
}
220224
}
221225

222226
if (apiKey) {
223227
if (apiKey.startsWith("seam_cst")) {
224-
console.warn(
225-
"Using API Key as Client Session Token is deprecated. Please use the clientSessionToken option instead."
226-
)
227-
return { "client-session-token": apiKey }
228+
throw new Error("You can't use a Client Session Token as an apiKey.")
228229
}
229230
if (!isValueUsedForBearerAuthentication(apiKey) && workspaceId)
230231
throw new Error(

0 commit comments

Comments
 (0)