brianc / node-postgres

PostgreSQL client for node.js.
https://node-postgres.com
MIT License
12.25k stars 1.22k forks source link

scram-sha-256 password authentication fails #2661

Open nguiard opened 2 years ago

nguiard commented 2 years ago

Trying to connect with a scram-sha-256 password fails (error: password authentication failed for user "<user>"), while md5 works.

Environmnent:

Steps to reproduce:

Androz2091 commented 2 years ago

any update?

fozcode commented 1 year ago

I had this issue too but I found this StackOverflow post that describes the additional procedure you have to follow before you can switch between md5 and scram-sha-256: https://stackoverflow.com/a/64317399/1671320

Essentially you have to change password_encryption in postgresql.conf and then update your Postgres user passwords and then enable scram-sha-256 in pg_hba.conf. Connections are working for me after this procedure.