-
Notifications
You must be signed in to change notification settings - Fork 565
Preserve custom url parameters in autoconnect #7778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Preserve custom url parameters in autoconnect #7778
Conversation
Co-authored-by: joaquim.verges <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe logic for extracting thirdweb-specific authentication parameters from URLs was updated to ensure only those parameters are removed, while preserving unrelated custom parameters. The test suite was expanded to verify that custom parameters remain intact after processing, and that only thirdweb parameters are stripped from the URL. Changes
Sequence Diagram(s)sequenceDiagram
participant Browser
participant getUrlToken
participant URL
Browser->>getUrlToken: Call with current URL
getUrlToken->>URL: Parse query parameters
getUrlToken->>URL: Extract thirdweb-specific params (walletId, authCookie, etc.)
getUrlToken->>URL: Remove only thirdweb params
getUrlToken->>Browser: Update URL (preserve custom params)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (4)**/*.{ts,tsx}📄 CodeRabbit Inference Engine (CLAUDE.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit Inference Engine (CLAUDE.md)
Files:
packages/thirdweb/src/wallets/**📄 CodeRabbit Inference Engine (CLAUDE.md)
Files:
**/*.test.{ts,tsx}📄 CodeRabbit Inference Engine (CLAUDE.md)
Files:
🧠 Learnings (15)📓 Common learnings
📚 Learning: applies to apps/{dashboard,playground-web}/**/*.{ts,tsx} : use `authorization: bearer` header – neve...
Applied to files:
📚 Learning: applies to dashboard/**/api/**/*.{ts,tsx} : pass the token in the `authorization: bearer` header – n...
Applied to files:
📚 Learning: applies to apps/{dashboard,playground-web}/**/*.{ts,tsx} : keep tokens secret via internal api route...
Applied to files:
📚 Learning: applies to dashboard/**/api/**/*.{ts,tsx} : always call `getauthtoken()` to get the jwt from cookies...
Applied to files:
📚 Learning: applies to apps/{dashboard,playground-web}/**/*.{ts,tsx} : always call `getauthtoken()` to retrieve ...
Applied to files:
📚 Learning: applies to dashboard/**/*client.tsx : prefer api routes or server actions to keep tokens secret; the...
Applied to files:
📚 Learning: applies to packages/thirdweb/src/wallets/** : support for in-app wallets (social/email login)...
Applied to files:
📚 Learning: in the thirdweb dashboard codebase, the `getteambyid` function was actually a wrapper around `gettea...
Applied to files:
📚 Learning: applies to dashboard/**/*.{ts,tsx} : reading cookies/headers with `next/headers` (`getauthtoken()`, ...
Applied to files:
📚 Learning: in the logout flow in apps/dashboard/src/app/(app)/account/components/accountheader.tsx, when `dolog...
Applied to files:
📚 Learning: applies to dashboard/**/*client.tsx : create light wrappers (e.g. `fetchjson`) that automatically at...
Applied to files:
📚 Learning: applies to test/src/test-wallets.ts : predefined test accounts are in `test/src/test-wallets.ts`...
Applied to files:
📚 Learning: applies to packages/thirdweb/src/wallets/** : eip-1193, eip-5792, eip-7702 standard support in walle...
Applied to files:
📚 Learning: applies to **/*.test.{ts,tsx} : keep tests deterministic and side-effect free...
Applied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
🔇 Additional comments (7)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
size-limit report 📦
|
<pr_request_template><!--
[SDK] Fix: Preserve custom URL parameters in
useAutoConnect
hookBLD-36
Notes for the reviewer
This PR modifies the
useAutoConnect
hook'sgetUrlToken
function to only remove thirdweb-specific query parameters (authResult
,walletId
,authProvider
,authCookie
) from the URL, while preserving all other custom parameters.Previously, the logic would strip all query parameters after processing the thirdweb ones, leading to loss of custom parameters as reported in the Slack thread.
How to test
Run the unit tests for
get-url-token.test.tsx
. New test cases have been added to specifically verify that custom parameters are preserved when thirdweb parameters are present.pnpm test packages/thirdweb/src/wallets/in-app/web/lib/get-url-token.test.tsx
--></pr_request_template>
Slack Thread
Learn more about Cursor Agents
PR-Codex overview
This PR focuses on updating the URL parameter handling in the
getUrlToken
function to preserve custom parameters while removing thirdweb-specific ones. It also updates the corresponding tests to reflect these changes.Detailed summary
get-url-token.ts
.thirdwebParams
to manage thirdweb-specific parameters.URLSearchParams
to preserve custom parameters.get-url-token.test.tsx
to check for correct URL updates and preservation of custom parameters.Summary by CodeRabbit