Skip to content

Missing idToken during Session Migration from v3 to v4 #2116

Closed
@KentoMoriwaki

Description

@KentoMoriwaki
Contributor

Checklist

  • The issue can be reproduced in the nextjs-auth0 sample app (or N/A).
    I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
    I have looked into the API documentation and have not found a suitable solution or answer.
    I have searched the issues and have not found a suitable solution or answer.
    I have searched the Auth0 Community forums and have not found a suitable solution or answer.
    I agree to the terms within the Auth0 Code of Conduct.

Description

When upgrading from nextjs-auth0 v3 to v4, I observed an issue where the idToken is not preserved during session migration. This causes unintended user logouts after upgrading.

The problematic code appears clearly at:
https://github.com/auth0/nextjs-auth0/blob/7bd83988caa15c89f3e7169e28dea4e820e9efc4/src/server/session/normalize-session.ts#L125C10-L131C14

Could you please clarify whether this omission is intentional? If this is not intentional, I'd be happy to submit a PR to address this issue.

Thank you!

Reproduction

  • Start the application using nextjs-auth0 v3 and log in.
  • Switch to a branch with v4 and upgrade the dependencies.
  • Reload the application and observe that the idToken is no longer present in the session.

Additional context

No response

nextjs-auth0 version

4.6.0

Next.js version

15.2.4

Node.js version

v20.12.0

Activity

frederikprijck

frederikprijck commented on May 26, 2025

@frederikprijck
Member

Hey, not intentional. Happy to look at a PR to solve it if you prefer. Let me know if not, then I can address this.

KentoMoriwaki

KentoMoriwaki commented on May 27, 2025

@KentoMoriwaki
ContributorAuthor

@frederikprijck Thanks for your comment. I created a PR #2120

tusharpandey13

tusharpandey13 commented on May 30, 2025

@tusharpandey13
Contributor

Thanks for the PR, it has been merged and will be released in the next minor release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @frederikprijck@KentoMoriwaki@tusharpandey13

        Issue actions

          Missing idToken during Session Migration from v3 to v4 · Issue #2116 · auth0/nextjs-auth0