-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Open
Labels
bugSomething isn't workingSomething isn't workingtriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Description
Environment
System:
OS: macOS 15.3.1
CPU: (11) arm64 Apple M3 Pro
Memory: 79.27 MB / 18.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 23.5.0 - ~/.nvm/versions/node/v23.5.0/bin/node
npm: 10.9.2 - ~/.nvm/versions/node/v23.5.0/bin/npm
Browsers:
Chrome: 133.0.6943.55
Safari: 18.3
npmPackages:
next: 15.1.2 => 15.1.2
next-auth: ^5.0.0-beta.25 => 5.0.0-beta.25
react: 19.0.0 => 19.0.0
Reproduction URL
https://github.com/hashirshoaeb/next-auth-test-app
Describe the issue
I’m experiencing an issue where the page visually updates after login, but the URL remains stuck on /login. Additionally, signing out does not work unless the page is manually refreshed. It started happening after upgrading Next.js, NextAuth.js, and React to the latest versions.
Previously Working Setup:
"dev": "next dev",
node: 18
"next": "^14.0.3",
"next-auth": "^5.0.0-beta.13",
"react": "18.2.0",
Updated Setup (Causing Issue):
"dev": "next dev --turbopack",
node: 22
"next": "15.1.2",
"next-auth": "^5.0.0-beta.25",
"react": "19.0.0",
#12697 looks similar issue.
How to reproduce
Steps to Reproduce:
- use the example link from Reproduction URL
- Run
npm install
- Run
npx auth secret
or put your AUTH_SECRET to the .env file - Run the app
npm run dev
- Visit /login and sign in.
- The page visually changes to the home page, but the URL remains stuck at /login.
- Clicking “Sign Out” at this point does nothing.
- Manually refreshing the page updates the URL correctly to /, and the sign-out button starts working.
I have recorded a demo video to explain the issue.
Screen.Recording.2025-02-27.at.12.07.31.AM.mov
Expected behavior
- After logging in, the URL should update correctly to / without requiring a manual refresh.
- The sign-out button should function properly without needing a hard refresh.
hashirshoaeb, iltan987, mrpaulmason and benevbright
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
Coding-faizan commentedon Feb 26, 2025
benhovinga commentedon Mar 4, 2025
@hashirshoaeb When using the
signIn()
function you need to addredirectTo
to it's options.In your file
actions/auth.actions.ts
file update thesignIn()
options.hashirshoaeb commentedon Mar 6, 2025
Thanks, it worked. Do you know how can I redirect to callback url then?
benhovinga commentedon Mar 6, 2025
@hashirshoaeb I am not sure what you mean by this. Typically the authenticating server (such as Google or Github) will reply to the callback URL with the authentication result. You typically don't send the user there.
Are you attempting to redirect the user to the page they were on before going to the login page? For that you would need to know where the user was prior to redirecting to the login page and pass that along such as in the searchParam
https://app.com/login?redirect=%2Fprofile
.azr-arch commentedon Mar 21, 2025
I'm experiencing the same issue, but I couldn't simply specify the redirect URL.
what I mean is that the application I'm working on includes both a normal user and an admin side