Next Auth does not fire callback and set session hook?
I added a Credentials provider in additional to my Discord provider (which worked fine), if I try to sign up I get a success value but the session does not update
Currently my nextauth file looks like this
This part in my frontend does not properly update after the signup process
status keeps being unauthorized.
Not sure what I may be missing here.
29 Replies
Hello, I have like this:
@rocawear thats the only difference on your side?
I think yes
Buut that the same right?
https://discord.com/channels/966627436387266600/1044140853041582142 here More talk about it
On your example on session you are using user instead of token atleast what I noticed
oh you are calling a callback url in your repo
I do this
you do this
oh wait that the login
sry
I can try to use the token 1min
nah same issue
Added some logs inside my callback
Seems like both are not logged 🤔 after running the signup
You are not using signIn?
I am using signup
Client API | NextAuth.js
The NextAuth.js client library makes it easy to interact with sessions from React applications.
Like this:
Yeah I think you should use signIn method
Or add what signIn does by yourself
So I would call register then sign in? Current register logic
Register normally how you do but login with the signIn
So when you login next auth adds some cookies (?) for you
So I guess I have to do this
But not quite sure what to add to callbackUrl in this case
Its where it redirects after login
You dont need to mutate
dang got an error,
http://localhost:3000/api/auth/error?error=pchstr%20must%20contain%20a%20%24%20as%20first%20char
does it create the user by default?
signIn is method that handles login for you
You are login not registering
yeah but to login I need to first create a user
I want the signup logic first before the sign in right
Yes,create user normally but when login use signin
yeah, I am doing the signup right now 😄
for login I am going to use signin
Look my repo as example how I did register
are you sure that credentials work with Prisma adapter, because in my code it didnt work with prisma
Yes
https://github.com/ruhap/t3-credentials/blob/main/src/components/form/RegisterForm.tsx
https://github.com/ruhap/t3-credentials/blob/main/src/server/trpc/router/auth.ts
GitHub
t3-credentials/RegisterForm.tsx at main · ruhap/t3-credentials
t3 stack with next-auth credential provider. Contribute to ruhap/t3-credentials development by creating an account on GitHub.
GitHub
t3-credentials/auth.ts at main · ruhap/t3-credentials
t3 stack with next-auth credential provider. Contribute to ruhap/t3-credentials development by creating an account on GitHub.
@rocawear if you register in your repo does it automatically update your user status?
Why would it? You are creating account,not login
It creates new user and redirects to login where I login with credentials
ah ok, that is what I meant with first creating the user then running the signin method earlier
Ok sorry,on mobile maybe I missed something
ok let me try to run them seperatly
give me 2 minutes 😄
signIn returns
http://localhost:3000/api/auth/error?error=pchstr%20must%20contain%20a%20%24%20as%20first%20char
dang