Skip to content

Conversation

@wolfgangGoedel
Copy link
Contributor

@wolfgangGoedel wolfgangGoedel commented Nov 3, 2025

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

📋 Changes

The beforeSessionSaved hook should be called with the updated session after the tokenSet has been refreshed. A recent change in this PR fixed the behavior when requesting the access token via the token route. Thanks again for having responded to my issue so promptly.

One case remains though where the old, buggy behavior remains: when getAccessToken is been called server side like it would be in next middleware. This PR fixes the issue in the same way the issue has been fixed elsewhere.

📎 References

related PR: fix: make sure beforeSessionSaved hook gets the updated token after refresh
initial issue: beforeSessionSaved behaves differently when called after login or after token refresh

🎯 Testing

Unit tests included with the PR

@wolfgangGoedel wolfgangGoedel requested a review from a team as a code owner November 3, 2025 14:14
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.88%. Comparing base (4a5834f) to head (0506e1e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2401      +/-   ##
==========================================
- Coverage   87.90%   87.88%   -0.03%     
==========================================
  Files          37       37              
  Lines        4127     4120       -7     
  Branches      818      819       +1     
==========================================
- Hits         3628     3621       -7     
  Misses        496      496              
  Partials        3        3              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

tusharpandey13 added a commit to tusharpandey13/nextjs-auth0 that referenced this pull request Nov 17, 2025
…th0#2401)

- Pass sessionChanges to finalizeSession so beforeSessionSaved hook receives refreshed tokens
- Add tests to verify beforeSessionSaved hook receives refreshed accessToken
- Add tests to verify changes made in beforeSessionSaved hook are honored

Co-authored-by: Wolfgang Goedel <[email protected]>
tusharpandey13 added a commit that referenced this pull request Nov 17, 2025
)

- Pass sessionChanges to finalizeSession so beforeSessionSaved hook receives refreshed tokens
- Add tests to verify beforeSessionSaved hook receives refreshed accessToken
- Add tests to verify changes made in beforeSessionSaved hook are honored

Co-authored-by: Wolfgang Goedel <[email protected]>
@tusharpandey13
Copy link
Contributor

This change is superseded by #2414. This was done to ensure that commits are signed. Orignal contribution history has been preserved. Hence closing this PR now.

tusharpandey13 added a commit that referenced this pull request Nov 17, 2025
)

- Pass sessionChanges to finalizeSession so beforeSessionSaved hook receives refreshed tokens
- Add tests to verify beforeSessionSaved hook receives refreshed accessToken
- Add tests to verify changes made in beforeSessionSaved hook are honored

Co-authored-by: Wolfgang Goedel <[email protected]>
@tusharpandey13 tusharpandey13 mentioned this pull request Nov 17, 2025
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.

3 participants