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

Commit 42be5d6

Browse files
committed
fix: rename function to isValueUsedForBearerAuthentication, reverse logic
1 parent 626de44 commit 42be5d6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/seam-connect/client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ export class Seam extends Routes {
148148
}
149149
}
150150

151-
const isValueUsedForAPIKeyAuthentication = (apiKey: string) =>
152-
!apiKey.startsWith("seam_at") &&
151+
const isValueUsedForBearerAuthentication = (value: string) =>
152+
value.startsWith("seam_at") ||
153153
/** Exclude JWT tokens as well */
154-
!apiKey.startsWith("ey")
154+
value.startsWith("ey")
155155

156156
const makeRequest = async <T>(
157157
client: Axios,
@@ -206,7 +206,7 @@ const getAuthHeaders = ({
206206
)
207207
return { "client-session-token": apiKey }
208208
}
209-
if (isValueUsedForAPIKeyAuthentication(apiKey) && workspaceId)
209+
if (!isValueUsedForBearerAuthentication(apiKey) && workspaceId)
210210
throw new Error(
211211
"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."
212212
)

0 commit comments

Comments
 (0)