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

Commit 9db6068

Browse files
authored
Merge pull request #194 from seamapi/seam-client-fix
fix: don't consider JWT tokens as API Key authentication values
2 parents 84f1235 + 42be5d6 commit 9db6068

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/seam-connect/client.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ export class Seam extends Routes {
148148
}
149149
}
150150

151+
const isValueUsedForBearerAuthentication = (value: string) =>
152+
value.startsWith("seam_at") ||
153+
/** Exclude JWT tokens as well */
154+
value.startsWith("ey")
155+
151156
const makeRequest = async <T>(
152157
client: Axios,
153158
request: AxiosRequestConfig
@@ -201,7 +206,7 @@ const getAuthHeaders = ({
201206
)
202207
return { "client-session-token": apiKey }
203208
}
204-
if (!apiKey.startsWith("seam_at") && workspaceId)
209+
if (!isValueUsedForBearerAuthentication(apiKey) && workspaceId)
205210
throw new Error(
206211
"You can't use API Key Authentication AND specify a workspace. Your API Key only works for the workspace it was created in. To use Session Key Authentication with multi-workspace support, contact Seam support."
207212
)

0 commit comments

Comments
 (0)