wvn
wvn
Explore posts from servers
BABetter Auth
Created by wvn on 4/5/2025 in #help
Backup Verify
One think. Im redoing the whole auth system. Should i authenticate users at server on client ?
29 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Backup Verify
😄 i forgot about this
29 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Backup Verify
yeah i will test this tomorrow
29 replies
BABetter Auth
Created by wvn on 4/8/2025 in #help
Admin Role
Yeah it is in the dtb
4 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Backup Verify
const [backupCodes, setBackupCodes] = useState<string[]>([]);

function generateBackupCodesFn(options?: BackupCodeOptions) {
return Array.from({ length: options?.amount ?? 10 })
.fill(null)
.map(() => generateRandomString(options?.length ?? 10, "a-z", "0-9", "A-Z"))
.map((code) => `${code.slice(0, 5)}-${code.slice(5)}`);
}
setBackupCodes(generateBackupCodesFn());

<div className="grid grid-cols-2 gap-2">
{backupCodes.map((code, index) => (
<code key={index} className="text-sm font-mono">{code}</code>
))}
</div>
const [backupCodes, setBackupCodes] = useState<string[]>([]);

function generateBackupCodesFn(options?: BackupCodeOptions) {
return Array.from({ length: options?.amount ?? 10 })
.fill(null)
.map(() => generateRandomString(options?.length ?? 10, "a-z", "0-9", "A-Z"))
.map((code) => `${code.slice(0, 5)}-${code.slice(5)}`);
}
setBackupCodes(generateBackupCodesFn());

<div className="grid grid-cols-2 gap-2">
{backupCodes.map((code, index) => (
<code key={index} className="text-sm font-mono">{code}</code>
))}
</div>
29 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Backup Verify
Yeah gemme minute my server is having big problems rn. Give me 5 minutes
29 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Backup Verify
The backup codes ?
29 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Backup Verify
And for the error ?
29 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Backup Verify
No description
29 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Backup Verify
await authClient.twoFactor.verifyBackupCode({code: "N5stL-xDSAJ"}, {
onSuccess(){
console.log("Success")
//redirect the user on success
},
onError(ctx){
alert(ctx.error.message)
}
})
await authClient.twoFactor.verifyBackupCode({code: "N5stL-xDSAJ"}, {
onSuccess(){
console.log("Success")
//redirect the user on success
},
onError(ctx){
alert(ctx.error.message)
}
})
# SERVER_ERROR: Error: padded hex string expected, got unpadded hex of length 191
at hexToBytes (../src/utils.ts:56:20)
POST /api/auth/two-factor/verify-backup-code 500 in 237ms
# SERVER_ERROR: Error: padded hex string expected, got unpadded hex of length 191
at hexToBytes (../src/utils.ts:56:20)
POST /api/auth/two-factor/verify-backup-code 500 in 237ms
undefined
undefined
29 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Backup Verify
Just wondering.. What is this ?
customBackupCodesGenerate?: () => string[];
customBackupCodesGenerate?: () => string[];
29 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Backup Verify
No description
29 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Backup Verify
Okay i will try to do this
29 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Backup Verify
That code is for generating.. But if i wanna check it i do
await authClient.twoFactor.verifyBackupCode({code: "j1rFA-Z3tNz"}, {
onSuccess(){
console.log("Success")
//redirect the user on success
},
onError(ctx){
alert(ctx.error.message)
}
})
await authClient.twoFactor.verifyBackupCode({code: "j1rFA-Z3tNz"}, {
onSuccess(){
console.log("Success")
//redirect the user on success
},
onError(ctx){
alert(ctx.error.message)
}
})
I do this ?
29 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Backup Verify
so the thing here is: should i push the backup code with the score ( like this XXXX-XXXX ) Or without? XXXXXXXX
29 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Backup Verify
No description
29 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Backup Verify
i will try it tomorrow
29 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
OTP
Im just stupid and used OTP instead of TOTP
4 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Error generating backup codes
Yeah i switched to OTP
5 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Error generating backup codes
@Ping Can you help please ?
5 replies