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/nervous-tips-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

fix: allow account linking on thirdweb dashboard
15 changes: 14 additions & 1 deletion packages/thirdweb/src/utils/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

// if we have an auth token set, use that (thirdweb.com/dashboard sets this for the user)
// pay urls should never send the auth token, because we always want the "developer" to be the one making the request, not the "end user"
if (authToken && !isPayUrl(url)) {
if (authToken && !isPayUrl(url) && !isInAppWalletUrl(url)) {
headers.set("authorization", `Bearer ${authToken}`);
} else if (secretKey) {
headers.set("x-secret-key", secretKey);
Expand Down Expand Up @@ -140,6 +140,19 @@
}
}

function isInAppWalletUrl(url: string): boolean {
try {
const { hostname } = new URL(url);
// in app wallet service hostname always starts with "in-app-wallet." or "embedded-wallet."
return (
hostname.startsWith("in-app-wallet.") ||
hostname.startsWith("embedded-wallet.")
);
} catch {
return false;
}

Check warning on line 153 in packages/thirdweb/src/utils/fetch.ts

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/utils/fetch.ts#L152-L153

Added lines #L152 - L153 were not covered by tests
}

const SDK_NAME = "unified-sdk";

let previousPlatform: [string, string][] | undefined;
Expand Down
Loading