Using BcryptJS with Better-Auth
Hi everyone,
I’m looking for an example of how to use BcryptJS with Better-Auth. I have existing users with bcrypt-hashed passwords, so I need to configure the password option properly for both hashing and verifying passwords.
The documentation mentions:
"You can customize the password hashing function by setting the password option in the configuration. This option should include a hash function to hash passwords and a verify function to verify them."
However, I haven’t found any examples or further details, and this option isn’t listed in the options reference.
If anyone can provide an example or point me in the right direction, I’d really appreciate it!
Thanks!
5 Replies
check the docs here
it doesn't give a full example... but it got me closer but not sure how to write those functions for bcryptjs as they need input and so on.
straight from the source code types which you can find here
GitHub
better-auth/packages/better-auth/src/types/options.ts at main · bet...
The most comprehensive authentication framework for TypeScript - better-auth/better-auth
@DragonCoder99 You would simply do
thanks! 🙂