-
Notifications
You must be signed in to change notification settings - Fork 910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Add support for SCRAM-SHA-256 password authentication #817
Comments
Hello, I am also working with SCRAM-SHA-256, and i would love to be able to use it in my project. it gives the error My project is developped with go and angular, and i am using Buffalo framework and Postgresql. At the moment i am using md5, but seems to be deprecated. I am hoping to fix this issue soon. Thanks for the help. |
Submitted a pull request for this: #833 |
has now been added? |
Yes: #833 |
There is nothing special you need to do on the client side to make a connection using scram-sha-256. import(
"database/sql"
_ "github.com/lib/pq"
)
func main() {
connstr := "dbname=mydb host=localhost port=5432 user=myuser password='mypassword'"
pgdb, err := sql.Open("postgres", connstr)
if err != nil {
panic(err)
}
defer pgdb.Close()
err = pgdb.Ping()
if err != nil {
panic(err)
}
} However your postgres database server will need to support scram-sha-256. I think it's only supported in version 10 and up. To enable scram-sha-256 connections, your
|
@raz-varren Thanks for reply. But I still getting an error This is section of my
This is how I create new user:
I can normally login with |
All right, apparently I create user in wrong way and the reason it worked with psql is because I run it locally. I did this way and it solve the problem: SET password_encryption = 'scram-sha-256';
ALTER ROLE myuser SET password_encryption = 'scram-sha-256';
ALTER ROLE myuser WITH PASSWORD 'mypassword'; |
Why this issue is still open? |
pq updated due to issue with the latest postgress image "unknown authentication response: 10" lib/pq#817 Signed-off-by: GanjMonk <solov333@gmail.com>
I believe I ran into the same thing as @adubkov, on upgrade from postgres 11 -> 14 by way of The client side failed with the same error as mentioned above, while the server side logged this:
Yay maintenance-only project 😞 |
Hi @mjibson, could you please close this? Thank you! |
Thanks Matt! |
pq updated due to issue with the latest postgress image "unknown authentication response: 10" lib/pq#817 Signed-off-by: GanjMonk <solov333@gmail.com>
Since PostgreSQL password authentication with SCRAM-SHA-256 method is available: https://www.postgresql.org/docs/10/auth-methods.html.
Currently this library fails to connect when trying to authenticate to a server that enforces scram-sha-256 method with:
unknown authentication response: 10
Note: I'm currently having this problem with a project that vendors this library, but code at https://github.com/lib/pq/blob/master/conn.go#L1135 also lacks this authentication method.
The text was updated successfully, but these errors were encountered: