Support scram-sha-256 authentication
See original GitHub issueAs soon as I attempt a Client.connect I am having this error:
error: Uncaught Error: Unknown auth message code 10
throw new Error('Unknown auth message code ${code}');
^
at Connection.handleAuth (https://deno.land/x/postgres@v0.4.5/connection.ts:197:15)
at Connection.startup (https://deno.land/x/postgres@v0.4.5/connection.ts:155:16)
at async Client.connect (https://deno.land/x/postgres@v0.4.5/client.ts:14:5)
my client instantiation:
const client = new Client({
user: 'postgres',
password: 'postgres',
database: 'test',
hostname: 'localhost',
port: 5432,
})
The permissions at launch deno run --no-check --unstable --allow-net --allow-env --allow-read app.ts --local
The service is obviously running and I can access the database through other means with the same credentials.
Edit: It would seems like i am able to connect to a remote database, but not the local one.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:15 (3 by maintainers)
Top Results From Across the Web
To scram-sha-256 from MD5 in PostgreSQL- CYBERTEC
This article explains in simple steps how to improve security in PostgreSQL by converting from MD5 hashes to scram-sha-256.
Read more >SASL/SCRAM-SHA-256 Secure Password-based Authentication
This page provides an overview of the security and implementation considerations for using SCRAM-SHA-256 authentication in CockroachDB. CockroachDB supports ...
Read more >SCRAM — MongoDB Manual
When you use SCRAM-SHA-256 , MongoDB requires server-side password hashing, which means that the server digests the password. For more information, see db....
Read more >PostgreSQL - password authentication to SCRAM-SHA-256.
Change PostgreSQL Password Authentication to SCRAM-SHA-256. By default (out-of-the-box installation), Postgres uses md5 encryption.
Read more >Configuring the SCRAM-SHA-256 authentication
To configure the SCRAM-SHA-256 authentication · Navigate to the path where the file is available. Example path: /var/lib/pgsql/12/data/postgresql ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The error is related to supported encryption types. Newer versions of postgresql use scram-sha-256 for authentication. However, it appears that this driver only supports md5 encryption. To use new versions you will have to manually enter in a md5 hash for your postgres user’s password. How to generate md5 authentication for postgres: https://stackoverflow.com/a/58979721 Once you have the hash you can do:
This driver should be updated to use the newer authentication as it is more secure.
Thanks to the effort of @snsinfu this is now supported, you can take it for a ride before the 0.9.0 release by importing from
https://raw.githubusercontent.com/denodrivers/postgres/master/mod.tsClosed in #267