Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2577 +/- ##
=======================================
Coverage 90.48% 90.48%
=======================================
Files 53 53
Lines 6684 6684
Branches 1403 1403
=======================================
Hits 6048 6048
Misses 624 624
Partials 12 12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tusharpandey13
approved these changes
Apr 1, 2026
Contributor
|
LGTM |
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.
Summary
Adds documentation clarifying the correct
getAccessTokenusage in App RouterRoute Handlers that need to refresh the session and set additional cookies
on a controlled
NextResponse.Problem
When a Route Handler calls
getAccessToken({ refresh: true })withoutreq/resand then constructs a
new NextResponse()to append custom cookies, the refreshedsession
Set-Cookieheaders are missing from the returned response. They werewritten to Next.js's internal
cookies()store — a separate cookie jar from themanually constructed response object.
This is not a code bug — the SDK correctly serializes all cookie attributes
(
Domain,SameSite,Secure, etc.) in both code paths.Fix
Documentation only. Added a new example and
[!IMPORTANT]callout under"Forcing Access Token Refresh" in
EXAMPLES.mdexplaining that the explicitgetAccessToken(req, res, { refresh: true })signature must be used whenever aRoute Handler needs both the refreshed session cookies and custom cookies on the
same returned
NextResponse.Changes
EXAMPLES.md— new subsection "App Router Route Handlers — Refresh + Custom Response Headers/Cookies"