question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Passwordless login only works with the native client

See original GitHub issue

Below shows me trying to connect to the “tngfooty” database using a unix domain socket without specifying a password. If I use the native client, it works. With the javascript client, authenticaton fails.

pg = require 'pg'
# If this line is omitted, password authentication will fail.
# pg = pg.native
pg.connect 'postgresql:///tngfooty', (err, client) ->
    console.log err
    client.query 'select now() as when', (err, result) ->
        console.log 'Row count: %d', result.rows.length
        console.log 'When: %s', result.rows[0].when

(sorry for the coffeescript)

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
chbrowncommented, Feb 11, 2013

I was getting this because my dev machine defaulted to trust for local TCP connections, but my test/deploy machine defaulted to md5. To fix: sudo vim /etc/postgresql/9.1/main/pg_hba.conf and change the

host    all             all             127.0.0.1/32           md5

line to end with “trust” instead of “md5”. Then restart your postgres.

1reaction
bjournecommented, Oct 15, 2012

It’s not strange because the javascript bindings sends a username and password even if you dont want them to. In the above example it sends process.env.USER as the username and null as the password even though it shouldn’t do username authentication at all.

{ [error: password authentication failed for user "bjourne"]
  length: 96,
  name: 'error',
  severity: 'FATAL',
  code: '28000',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  file: 'auth.c',
  line: '273',
  routine: 'auth_failed' }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Passwordless login only works using directly invoked sshd on ...
This is an SELinux problem, caused by your home directory being in a weird location. The thing you did to disable it, didn't....
Read more >
Passwordless SSH only works when I'm already logged in on ...
Solution is to move the AuthorizedKeysFile to some other place, that will be accessible or us global store for keys ( /etc/security/ ...
Read more >
How to Set Up SSH Passwordless Login (Step-by-Step Tutorial)
Step 1: Generate a key pair. Step 2: Create SSH directory on server. Step 3: Upload public key to remote server. Step 4:...
Read more >
Passwordless Connections - Auth0
When a user authenticates via passwordless, the user is attached to the connection using Auth0 as the Identity Provider (IdP). Since you can't...
Read more >
Enable passwordless sign-in with Microsoft Authenticator
When a user has enabled any passwordless credential, the Azure AD login process stops using the login_hint. Therefore the process no longer accelerates...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found