-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Next auth credentials authentication #12005
Comments
To fix the issue with Next.js credentials authentication, where the session stays null and the URL doesn't update after login, first ensure you're using useSession() correctly for session updates. When calling signIn, set redirect: false and manually handle the redirect with router.push(). Also, double-check your credentials provider setup in nextauth.js to make sure everything is configured properly. You can enable debugging to get more insight into the problem. If you're still facing the issue after trying these steps, feel free to provide me with the codebase, and I'll take a closer look! |
Your problem it's related to known issue. Take a look at #9504 |
export async function authenticate(
} catch (error) { useEffect(() => { and still error is still there it seems like client componets useSession do get session and url tittle updates but actual url does not update |
This comment has been minimized.
This comment has been minimized.
minimized |
Environment
System:
OS: Windows 11 10.0.22631
CPU: (4) x64 Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz
Memory: 1.17 GB / 7.90 GB
Binaries:
Node: 20.16.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.22 - ~\AppData\Roaming\npm\yarn.CMD
npm: 10.8.1 - C:\Program Files\nodejs\npm.CMD
pnpm: 9.11.0 - ~\AppData\Local\pnpm\pnpm.CMD
Browsers:
Edge: Chromium (127.0.2651.98)
Internet Explorer: 11.0.22621.3527
npmPackages:
@auth/firebase-adapter: ^2.5.3 => 2.5.3
next: 14.2.13 => 14.2.13
next-auth: ^5.0.0-beta.22 => 5.0.0-beta.22
react: ^18 => 18.3.1
Reproduction URL
https://github.com/Ikuzweshema/next-auth-example
Describe the issue
Next js credentials authentication when a user loggs in with email and password user is redirected but the session remains null and url does not change until you refresh the page do you also face that error??.i dont know if it is for me only or you also face that issue.
How to reproduce
i think client components do not get the session when we redirect back and the url does not update so i think you can fix this issue
Expected behavior
As like other providers like google the session should be working as expected and also url should change.
The text was updated successfully, but these errors were encountered: