Session cookie not being set upon signup
I am using the email & password provider, I have a sign up process that includes verifying the email and adding 2fa by default through totp or an authernticator app.
At first I call the email.singup method I get the created user data back
The next step is to verify the email which works, an email is sent and the verification link works and the user table is updated.
The next step is to enable 2fa and add an authenticator app, but when I call the enable function with the user's password I get a 401 back
Im using next.js and trpc.
I have set the autoSignInAfterVerification to true, which helped with getting actual session cookies assigned, but I am still getting 401 back 🤦♂️
What am I doing wrong?
Solution:Jump to solution
When calling the auth.api on the server we need to pass the damn headers 🤦
```ts
const data = await auth.api.enableTwoFactor({
body: { password: input.password },
headers: await headers(),...
1 Reply
Solution
When calling the auth.api on the server we need to pass the damn headers 🤦