problems with next-auth
I have had problems with next-auth, with discord (or any provider), I downloaded the next authjs demo and it doesn't work either.
https://github.com/nextauthjs/next-auth-example
GitHub
GitHub - nextauthjs/next-auth-example: Example showing how to use N...
Example showing how to use NextAuth.js with Next.js - GitHub - nextauthjs/next-auth-example: Example showing how to use NextAuth.js with Next.js
80 Replies
Idk what you want us to do about that,
"doesn't work"
is not very specific...Well, there is nothing, there is nothing, even with debug active.
there is nothing
I have everything the same as the next-auth example, it does not show any error log.
You didn't set environment variables or?
Did you do any of the steps it says to
You need more than that
what do you need? can I send you a picture of something?
No, you need more environment variables than that
i also have the [nextauth].ts if you mean that, the options and parameters and the sessioncontext
sure?
It says here that only these two, what else?
No it doesn't
Lemme quote it
Add details for one or more providers (e.g. Google, Twitter, GitHub, Email, etc).
ISCORD_CLIENT_ID=1146254896799158284
DISCORD_CLIENT_SECRET=xxx*
I also have this.
And you pushed your prisma schema to your db
yes
ignore other tables, they are not used at all.
the db is from the next-auth example
And you setup a callback url in discord
yes
And there is no errors in either of your consoles when clicking the login button
you have clicked" but no error is displayed. none
not even on the server console?
nup
I'm going crazy
I don't understand what's going on.
node version?
18
show login component
What if you change this to https
I also tried with callbackUrl, parameters etc and none of them worked.
it is localhost. it should not matter.
1s
https://localhost:3000/api/auth/callback/discord
this?
yh
hm
nu
same
xD
ok browser problem i think
try incognito
or other browser
I did it too, it doesn't work on any of them
;D
chrome, brave, firefox, etc
/auth/signin?csrf=true
csrf=true
wtf
what if you remove the void here
1s
same
same
yeah ignore it
what about when it runs
yes yes, it doesn't work, it's the same
xD
what if you have a button
nothing the same as above
1s
no shadcn
just normal button
I don't use shadcn, but will put it native 1s
nothing
same
what if you call signIn("discord") literally just in the page
in fact, it doesn't work here either ;D
okay
1s
useEffect?
nono
just in page
it will redirect you anyways
nothing
it's a client component right
no errors anywhere?
I use pages, so I shouldn't.
1s
"use client";
use client is not for pages
same
the same thing happens
nup
show your next auth config again but the whole thing
imports everything
1s
1 last idea in my head lol
s
1s*
it doesn't work either, if I remove the role, in case you had any doubts xD
what if you ditch env, and just copy pasta the keys in
hm
1s
nothing
same result
idk anymore lol
i gotta go take the fucking bus, maybe share repo maybe someone can clone it locally and see if it works for them and report back
"next": "^13.4.5",
"next-auth": "^4.23.0",
using an https domain does not work either.
Check your db, if you have any user and accounts, delete everything and try once more.
Try different browsers and double check everyting
Clear your cookies as well
I have tried everything and nothing works, even downloading the t3 template does not work.
;D
@miia.dev did you happen to find a solution?
I've been struggling with the same issue for quite a while
It seems completely random. I've managed to get the signin to work for a while but even then it will not work if I try to open a parallel session in incognito mode
We discussed it here https://discord.com/channels/966627436387266600/1140674141872197662 but found no clues
Hmm, found this thread https://discord.com/channels/966627436387266600/1146902566848970882 and upgrading to latest Node version seemed to work
For now... 😄
@j6rms It ends up fixing it, deleting all dependencies and running an npm upgrade (absolute), basically update all libraries, existing in the project to the latest possible no matter if there are errors or incompatibility, it seems to be a node+nextjs problem and a weird interaction with some method.