#bcrypt and Nextjs 13 Server Side Pages

1 messages · Page 1 of 1 (latest)

obsidian moss
#

I've found out that bcrypt is not working in AuthOptions authorize function in next-auth...any ideas how to resolve? This only happens when using unstable_ServerSession. It works good for logging in.

I think the problem is because bcrypt use @mapbox which is a server component.
When using unstable_ServerSession on a nextJs 13 Server Component, somehow it use @mapbox on client side so i get the error.
I solved using "bcryptjs" instead than "bcrypt" inside api/[...nextauth].js.

Is bcryptjs as good as bcrypt? Any opinion about my solution?