Migration from SQL DB to PostgreSQL DB Password Verification Error
Trying to migrate users/accounts from my SQL DB (pre better-auth implementation) to a PostgreSQL DB (better-auth implementation). However, when hashing the passwords with
Scrypt.NET
and trying to login I get a
error. It seems like the verification of the password algorithm expects the password in a feasible manner. Any guides on how to do that?
From better-auth code I can see:
The key is probably undefined since it splits the hash based on a :
and my hash does not contain it. I get something like $s2$16384$8$1$J9a1G+QkkzGODG1ZixgwsLTe7Q5t4QCH2LEQFFISGKs=$BG546zv4T7hkLPo0FPeP1eXIzhyyjnpLyOkInM9oCMo=
when hashing it via. the Scrypt.NET
library.Solution:Jump to solution
Implemented the functions like the following
```ts
import { scrypt, randomBytes } from "crypto";
const scryptAsync = (
password: string | Buffer,...
3 Replies
Looks like I can tweak the hashing and verification by implementing custom functions https://www.better-auth.com/docs/authentication/email-password#configuration
Solution
Implemented the functions like the following
And now it works