-
Notifications
You must be signed in to change notification settings - Fork 361
feat(nextjs): Support Keyless mode #4602
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
feat(nextjs): Support Keyless mode #4602
Conversation
🦋 Changeset detectedLatest commit: b04a9d2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 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 |
…der and update middleware to read sk and pk from cookies
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
8f908b0
to
18e8fe4
Compare
18e8fe4
to
5e0181d
Compare
React does not like the fact that <html><body> may be missing and that Suspense is not used inside <html>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 left a few minor comments, but functionally I think this is good to go! Nice job
Co-authored-by: Lennart <[email protected]>
…s-in-clerknextjs # Conflicts: # packages/nextjs/src/app-router/server/ClerkProvider.tsx
Description
Opt-in support for Keyless
This is introduced for
@clerk/nextjs
but more sdks may follow in the future.What does the PR do (for development only).
.clerk/
Technical
For ClerkProvider as RSC:
clerkMIddleware
detects missing sk -> basically calls next() as "signed-out" and let rendering to call Server ClerkProvider -> Server ClerkProvider fetches and creates the keys, stores them into a file -> It passes the keys into a client component that will fire a server action on mount that sets the keys into cookies and redirect to a made up url thatclerkMiddelware
expects ->clerkMiddleware
runs again, this time detects the cookies that contain the accountless keys and properly propagates the pk and sk further down.For ClerkProvider as Client component: The provider will render which fires a server action that creates the keys and set them into cookies. Once this is completed we return only the PK and the claimUrl and we force the ClerkProvider from clerk-react to remount.
Requirements
Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change