feat(clerk-js): Send previous session token on /tokens requests#8105
feat(clerk-js): Send previous session token on /tokens requests#8105nikosdouvlis wants to merge 2 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 388086f The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Send the current session JWT as `token` in the POST body when requesting a token refresh. This lets the FAPI Proxy forward it to Session Minter for claim cloning without a DB read. Uses conditional spread so the key is absent (not `token=`) when there's no previous token (first mint).
f0b2a14 to
cbc83a0
Compare
Unit tests verify the token param is present when lastActiveToken exists, absent on first mint, absent for template requests, and matches getRawString() exactly. E2e test verifies token refresh still works with the new param in the POST body.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis pull request adds functionality to send the previous session token in /tokens requests to support Session Minter edge token minting. The implementation modifies the token resolver creation in Session.ts to conditionally include the current lastActiveToken as a token parameter alongside organizationId. A changeset entry marks the clerk-js package for a patch release. Tests are added to verify the request body formation, confirming the token is included when lastActiveToken exists and excluded for template requests or initial token minting. 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Comment Tip CodeRabbit can generate a title for your PR based on the changes with custom instructions.Set the |
Why
Session Minter needs the previous session JWT to clone claims at the edge without hitting the DB.
What
Send
token(previous session JWT) in the POST body on non-template/tokensrequests. Uses conditional spread so the key is absent (nottoken=) when there's no previous token.The
tokenparam is currently ignored by the backend and will be wired up in PLAT-2471.Test plan
tokenappears in POST body when a previous token existstokenkey is absent on first minttokenis not sent for template token requestsSummary by CodeRabbit
Bug Fixes
Tests