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
Slavi
Slaviā€¢8mo ago
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
alan
alanā€¢8mo ago
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...
Slavi
Slaviā€¢8mo ago
I see
Slavi
Slaviā€¢8mo ago
it gives you more things to look at What application are you building exactly?
alan
alanā€¢8mo ago
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
Slavi
Slaviā€¢8mo ago
Oh, I can only help you with this differen perspective hope it helps you with something I have some bad issues as well šŸ˜©
alan
alanā€¢8mo ago
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
alan
alanā€¢8mo ago
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.
Slavi
Slaviā€¢8mo ago
Ok, thanks I will look sr it
alan
alanā€¢8mo ago
another update. the fix didn't hold for some reason and I now just switched to Lucia auth
Slavi
Slaviā€¢8mo ago
How do you update the db with the user? Weren't Lucia's users stored on their servers?
Want results from more Discord servers?
Add your server