Skip to content

FR-22443 Enhance getSession function to require response object - #436

Merged
vladFrontegg merged 1 commit into
masterfrom
FR-22443-get-session-drops-refresh-token-when-context-res-not-passed-to-get-session
Oct 23, 2025
Merged

FR-22443 Enhance getSession function to require response object#436
vladFrontegg merged 1 commit into
masterfrom
FR-22443-get-session-drops-refresh-token-when-context-res-not-passed-to-get-session

Conversation

@vladFrontegg

@vladFrontegg vladFrontegg commented Oct 22, 2025

Copy link
Copy Markdown
Collaborator

This pull request updates the getSession function to require an explicit res (response) parameter and clarifies its usage through improved documentation. The main goal is to ensure the function is used correctly in scenarios involving sequential redirects or multiple server-side executions.

Key changes:

Session Handling Improvements:

  • Updated the getSession function signature to require the res parameter explicitly, improving clarity and preventing misuse in complex server-side flows.
  • Updated the call to getSession in FronteggApiMiddleware.ts to pass both req and res, ensuring compatibility with the new function signature.

Documentation:

  • Added a detailed JSDoc comment to getSession explaining the purpose of the parameters and when res must be provided, aiding future maintainability and correct usage.

Note

Make getSession require an explicit res parameter, add JSDoc, and update middleware to pass req and res.

  • Auth session helpers (packages/nextjs/src/pages/helpers.ts):
    • Change getSession(req, res) to require res (no longer optional) and add detailed JSDoc.
  • Middleware (packages/nextjs/src/middleware/FronteggApiMiddleware.ts):
    • Update call to getSession(req, res) when secure JWT is enabled to set authorization header from session token.

Written by Cursor Bugbot for commit ecbd358. This will update automatically on new commits. Configure here.

@vladFrontegg
vladFrontegg merged commit 8eaf28b into master Oct 23, 2025
2 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.

2 participants