-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Wrong URL after calling signIn function when using custom sign-in page #12697
Comments
having the exact same issue. fresh installed few days ago, then facing this issue
in my old project with the following version, I didn't have this problem
|
I tried to see the issue by checking next-auth code. Everything seems fine. I debugged it and URL seems fine. Only thing I suspect is redirect function from next/navigation. It takes the URL. Maybe in that version, there is a bug with redirect function. I don't know. This code piece is responsible of redirecting: next-auth/packages/next-auth/src/lib/actions.ts Lines 35 to 39 in af2ccea
I am searching but can someone please check if the issue is because of redirect function in next/navigation? EDIT: |
Example app in apps/dev/nextjs is somehow working. I think it's about layout file. Because when I put my code to the root layout file, it starts working... So strange |
@iltan987 what do you mean by?
|
There are redirect functions, right? As I mentioned in the issue. One from next-auth/react package, one from NextAuth instance. |
Facing the same issue with a custom login page but everything works just fine on /api/auth/signin . Just getting NEXT_REDIRECT issues regardless of how i configure Google auth. |
Environment
Reproduction URL
https://github.com/iltan987/redirect-issue
Describe the issue
First of all, this example is using custom sign in page.
As I understood, there are 2 ways to redirect user to sign-in page. Server-side and client-side. Using signIn function coming from the NextAuth instance in auth.ts (method 1 in my code) and using signIn function from "next-auth/react" (method 2)
The problem is when you use method 1, URL is not correct but rendered page is correct, just the URL wrong. You can see the correct URL only if you refresh the page manually.
Method 2 works completely fine; both URL seen in browser and rendered page are correct.
How to reproduce
npm install
npx auth secret
or put your AUTH_SECRET to the .env filenpm run dev
Expected behavior
Same as method 2, without needing to refresh the page manually, URL in the browser should be same as the URL specified in NextAuth config
The text was updated successfully, but these errors were encountered: