20 Replies
ig the error occurs because you're trying to use a hardcoded backup code "j1rFA-Z3tNz" which doesn't match the expected format. you might need to generate backup codes for your user. You can do this by calling the
generateBackupCodes
.i will try it tomorrow
Im gettingn2FA codes from enable
like data.backuoCodes
Is that correct?

so the thing here is: should i push the backup code with the score ( like this XXXX-XXXX )
Or without? XXXXXXXX
you can also enable to use the custom one as well if you wish
That code is for generating.. But if i wanna check it i do
I do this ?
I mean generating with some format makes it easier on verifying it later
Okay i will try to do this
i mean the generating works. But the checking for the codes. Do i somehow need to save them in database or just default like it is in the docs ?

Just default like the docs
Just wondering.. What is this ?
any idea ?

This is for you to do a custom backup codes
And for the error ?
How are you generating it
Like the code snippets
The backup codes ?
Yeah
Yeah gemme minute my server is having big problems rn. Give me 5 minutes
You can use the internal generateCode and pls refer to this internal test and lemme know if does not work for you - https://github.com/better-auth/better-auth/blob/main/packages%2Fbetter-auth%2Fsrc%2Fplugins%2Ftwo-factor%2Ftwo-factor.test.ts#L167-L244
GitHub
better-auth/packages/better-auth/src/plugins/two-factor/two-factor....
The most comprehensive authentication framework for TypeScript - better-auth/better-auth
yeah i will test this tomorrow
š i forgot about this
One think. Im redoing the whole auth system. Should i authenticate users at server on client ?
Do you know why ?