Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/wicked-chairs-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

when explicitly passing `clientId` to `createThirdwebClient()` prefer it over computing the `clientId` from a passed `secretKey` option
4 changes: 2 additions & 2 deletions packages/thirdweb/src/client/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ describe("client", () => {
expect(client.clientId).toBe(computeClientIdFromSecretKey("bar"));
expect(client.secretKey).toBe("bar");
});
it("should ignore clientId if secretKey is provided", () => {
it("should NOT ignore clientId if secretKey is provided", () => {
const client = createThirdwebClient({ clientId: "foo", secretKey: "bar" });
expect(client.clientId).toBe(computeClientIdFromSecretKey("bar"));
expect(client.clientId).toBe("foo");
expect(client.secretKey).toBe("bar");
});
it("should throw an error if neither clientId nor secretKey is provided", () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/thirdweb/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ export function createThirdwebClient(
throw new Error("clientId must be provided when using a JWT secretKey");
}
} else {
realClientId = computeClientIdFromSecretKey(secretKey);
// always PREFER the clientId if provided, only compute it from the secretKey if we don't have a clientId passed explicitly
realClientId = clientId ?? computeClientIdFromSecretKey(secretKey);
}
}

Expand Down
Loading