Skip to content

Commit e8b2580

Browse files
committed
Only set secret key or client ID when not using auth token (#6994)
This PR modifies the header setting logic in `getClientFetch` to ensure that secret keys and client IDs are only set when not using an auth token. This prevents potential conflicts between different authentication methods by making the header setting logic mutually exclusive.
1 parent 585ba2f commit e8b2580

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

packages/thirdweb/src/utils/fetch.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,15 @@ export function getClientFetch(client: ThirdwebClient, ecosystem?: Ecosystem) {
7070
if (client.teamId) {
7171
headers.set("x-team-id", client.teamId);
7272
}
73-
}
74-
75-
if (secretKey) {
76-
headers.set("x-secret-key", secretKey);
77-
}
73+
} else {
74+
// onlu set secret key or client id if we are NOT using the auth token!
75+
if (secretKey) {
76+
headers.set("x-secret-key", secretKey);
77+
}
7878

79-
if (clientId) {
80-
headers.set("x-client-id", clientId);
79+
if (clientId) {
80+
headers.set("x-client-id", clientId);
81+
}
8182
}
8283

8384
if (ecosystem) {

0 commit comments

Comments
 (0)