feat(clerk-js): Send previous token and force_origin on /tokens requests#8096
Closed
nikosdouvlis wants to merge 3 commits intomainfrom
Closed
feat(clerk-js): Send previous token and force_origin on /tokens requests#8096nikosdouvlis wants to merge 3 commits intomainfrom
nikosdouvlis wants to merge 3 commits intomainfrom
Conversation
Session Minter needs an oiat (original_issued_at) field in the JWT header to track when token claims were last assembled from the DB. This enables monotonic freshness checks that prevent edge-minted tokens with stale claims from overwriting fresher ones. Marked @internal so developers don't depend on this field.
Two changes to Session.#createTokenResolver(): 1. Send the current session JWT as `token` in the POST body on non-template /tokens requests. This lets the FAPI Proxy forward it to Session Minter for claim cloning without a DB read. 2. Send `force_origin=true` in the query string when skipCache is true. This tells the FAPI Proxy to route directly to origin instead of Session Minter, preserving the skipCache contract of always returning authoritative DB-minted tokens.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
10 tasks
🦋 Changeset detectedLatest commit: 0adfe52 The changes in this PR will be included in the next version bump. This PR includes changesets to release 21 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 |
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Session Minter needs the previous session JWT to clone claims at the edge without hitting the DB. It also needs a way for
skipCachecallers to bypass the edge minter and go straight to origin.What
oiat(original_issued_at) toJwtHeadertype, marked@internal. Session Minter uses this to track when claims were last assembled from the DB. Lives in the JWT header, not payload.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.force_origin=truein the query string whenskipCache: true. Tells FAPI Proxy to route to origin instead of Session Minter.Both params are currently ignored by the backend and will be wired up in PLAT-2471 and PLAT-2472.
Test plan
tokenappears in POST body when a previous token existstokenkey is absent on first mint (no previous token)tokenis not sent for template token requestsforce_origin=truein query string whenskipCache: trueforce_originabsent whenskipCache: false