Skip to content
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

fix: read and migrate v3 session format to v4 #1923

Merged
merged 3 commits into from
Feb 18, 2025

Conversation

guabu
Copy link
Contributor

@guabu guabu commented Feb 17, 2025

📋 Changes

When migrating from v3 to v4 of the SDK, the session format and cookie names differ. This results in the SDK not recognizing that the user has a session and treating them as logged-out.

This PR adds support for reading the v3 session format in both stateless and stateful modes and normalizes them to the v4 format. This ensures that users with existing sessions will be respected in v4.

📎 References

🎯 Testing

  • Unit tests have been added for both stateful and stateless modes
  • Manual tests were run by following the reproduction steps in the referenced issue above to confirm that v3 sessions are smoothly migrated (both stateful and stateless modes)
  • Custom cookie names were also tested to ensure they are recognized and migrated

@guabu guabu requested a review from a team as a code owner February 17, 2025 08:05
@codecov-commenter
Copy link

codecov-commenter commented Feb 18, 2025

Codecov Report

Attention: Patch coverage is 93.43066% with 9 lines in your changes missing coverage. Please review.

Project coverage is 76.06%. Comparing base (33c210d) to head (515d714).

Files with missing lines Patch % Lines
src/server/cookies.ts 91.66% 4 Missing ⚠️
src/server/session/stateful-session-store.ts 91.17% 3 Missing ⚠️
src/server/session/normalize-session.ts 95.65% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1923      +/-   ##
==========================================
+ Coverage   74.69%   76.06%   +1.37%     
==========================================
  Files          19       20       +1     
  Lines        1379     1496     +117     
  Branches      210      233      +23     
==========================================
+ Hits         1030     1138     +108     
- Misses        342      351       +9     
  Partials        7        7              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@arpit-jn arpit-jn merged commit fd6a68f into auth0:main Feb 18, 2025
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to v4 causes logout for existing users
5 participants