How to fix next auth beta redirecting to undefined path
hello. I'm trying to work with next auth beta and it's redirecting me to localhost:3000/undefined after signing in and I was wondering how to fix this such that I get redirected either to /signin or /. Thank you.
12 Replies
Shouldn't you add an origin url in your google console's project?
I am thinking if using next auth beta as well, but I am not sure how to implement my own form
Are you watching some kind of tutorial?
@alan
I just used https://www.youtube.com/watch?v=DJvM2lSPn6w
Lee Robinson
YouTube
Next.js App Router Authentication (Sessions, Cookies, JWTs)
Learn the foundations of session based authentication through cookies in the Next.js App Router, and how community libraries like Auth.js build on top of this model. Auth is a deep topic, so let me know what else you want to see here!
ā Basic: https://github.com/balazsorban44/auth-poc-next
ā NextAuth: https://github.com/vercel/next.js/tree/cana...
I see
Tbh, this one is better even though it is 2 months ago: https://www.youtube.com/watch?v=1MTyCvS05V4&t=5567s
Code With Antonio
YouTube
Next Auth V5 - Advanced Guide (2024)
Discord for any problems/errors/bugs: https://www.codewithantonio.com/discord
Github & Live Website: https://www.codewithantonio.com/projects/auth-masterclass
Auth.js: https://authjs.dev/
Middleware config: https://dub.sh/Apr6dvD
Resend: https://resend.com/
Node.js: https://nodejs.org/en
ShadcnUI: https://ui.shadcn.com/
Clerk: https://dub.sh/SdV...
it gives you more things to look at
What application are you building exactly?
I'm just looking to build a very simple to do app behind auth using nextjs or t3 app. I tried to update a generated t3 app with next auth beta but it's having its own issues
Oh,
I can only help you with this differen perspective
hope it helps you with something
I have some bad issues as well š©
I'm also seeing this being logged:
[1] [auth][error] UnknownAction: Cannot parse action at /signin/github .Read more at https://errors.authjs.dev#unknownaction
I found out a few things. When updating next auth, setting
NEXTAUTH_URL="http://localhost:3000"
will lead to some strange breakage. I had thought that even though the docs don't mention using this env var, it would be harmless to keep this in from next auth < v5. Additionally, it insists on having the AUTH_SECRET
env var defined, even when trying to run in dev, whereas in previous versions it seemed to only break when trying to deploy to Vercel. Otherwise, the rest of the steps outlined in https://authjs.dev/guides/upgrade-to-v5 works for me.Upgrade Guide (v5) | Auth.js
NextAuth.js version 5 is a complete rewrite of the package, but we made sure to introduce as little breaking changes as possible. For anything else, we summed up the necessary changes in this guide.
Ok, thanks
I will look sr it
another update. the fix didn't hold for some reason and I now just switched to Lucia auth
How do you update the db with the user? Weren't Lucia's users stored on their servers?