Cannot enable two-factor Authentication
Running auth.api.enableTwoFactor gives me a 401 error. How can I resolve this?
Versions
better-auth: 1.2.2
react-router: 7.2.0
To Reproduce
Result
3 Replies
it requires a header object
Thanks for the reply, the same error occurs even after modification.
if the user hasn't signed in yet the headers won't contain the cookie. That's why it's still throwing error. I'd recommend calling enable 2fa after the user has signed in. And I suggest calling it fomr the client instead of an action.