Draft
Conversation
This fix addresses the issue where users lose their invitation token when they reset their password during the invitation acceptance flow. Changes: - Add invitation token persistence utility that stores the token in a httpOnly cookie when a user lands with ?invitation_token= in the URL - Add InvitationTokenCapture component in the root layout to automatically capture and store invitation tokens from URL parameters - Update all authentication methods (email/password, magic auth, OAuth, SSO) to check for and use stored invitation tokens - Token is automatically consumed (deleted) after being used in an authentication request This ensures that if a user: 1. Receives an invitation with invitation_token in URL 2. Clicks to accept but forgets their password 3. Resets their password 4. Signs in after password reset The invitation token will still be available to accept the invitation and properly set up their organization membership and custom JWT claims. Co-authored-by: Alex Southgate <southgate@users.noreply.github.com>
|
Cursor Agent can help with this pull request. Just |
- Add Jest testing framework setup - Add unit tests for invitation-token utility functions - Add tests for InvitationTokenCapture component - Add flow simulation tests verifying token persistence All 14 tests passing. Co-authored-by: Alex Southgate <southgate@users.noreply.github.com>
This endpoint allows testing the invitation token cookie flow: - Store, get, consume, and clear operations - Useful for verifying the fix works in development Note: Consider removing or protecting this endpoint in production. Co-authored-by: Alex Southgate <southgate@users.noreply.github.com>
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.
Implement invitation token persistence to prevent users from losing their invitation during password reset flows.
This fixes a bug where the
invitation_tokenwould be lost if a user initiated a password reset before accepting an invitation, leading to the JWT missing custom claims. The token is now captured and stored securely in an httpOnly cookie, then reused upon successful authentication.Slack Thread