<p>I tried the following, and it works:</p>

<pre><code>const Client = require('bitcoin-core');

const client = new Client(
    {   
        username: 'yourUsernameHere',
        password: 'yourPasswordHere',
        port: '8332'
    }
);

client.getInfo().then((help) =&gt; console.log(help));
</code></pre>

CC BY-SA 3.0
2017-07-31T15:30:12.727Z
2017-07-31T15:30:12.727Z
Paul
<p><a href="https://github.com/seegno/bitcoin-core" rel="nofollow noreferrer">https://github.com/seegno/bitcoin-core</a>
After using npm to install, I get an auth error when I try to run it.
The github repo isn't clear how to auth...</p>

<pre><code>const Client = require('bitcoin-core');
const client = new Client({ network: 'mainnet' });

client.getInfo().then((help) =&gt; console.log(help));
</code></pre>

<p>I was able to auth using the older package: <a href="https://github.com/freewil/node-bitcoin" rel="nofollow noreferrer">https://github.com/freewil/node-bitcoin</a></p>

<p>Using but with my own credentials:</p>

<pre><code>var client = new bitcoin.Client({
  host: 'localhost',
  port: 8332,
  user: 'username',
  pass: 'password',
  timeout: 30000
});
</code></pre>

<p>Really lost how to do it on the newer one.</p>

<node.js>
Authenticating with npm nodejs bitcoin-core module
J. Andrew
# Authenticating with npm nodejs bitcoin-core module

(Asked by: username_0 on 2017-07-05)

<https://github.com/seegno/bitcoin-core>
After using npm to install, I get an auth error when I try to run it.
The github repo isn't clear how to auth...

```
const Client = require('bitcoin-core');
const client = new Client({ network: 'mainnet' });

client.getInfo().then((help) => console.log(help));

```

I was able to auth using the older package: <https://github.com/freewil/node-bitcoin>

Using but with my own credentials:

```
var client = new bitcoin.Client({
  host: 'localhost',
  port: 8332,
  user: 'username',
  pass: 'password',
  timeout: 30000
});

```

Really lost how to do it on the newer one.

**Tags:** node.js


---

## 1 answers

### Answer by username_1 on 2017-07-31. Score: 2 | Accepted answer

I tried the following, and it works:

```
const Client = require('bitcoin-core');

const client = new Client(
    {   
        username: 'yourUsernameHere',
        password: 'yourPasswordHere',
        port: '8332'
    }
);

client.getInfo().then((help) => console.log(help));

```


---

