Bitcoin RPC returning 401 I am using node-bitcoin-rpc to do some api calls to bitcoind, but I am getting 401 error. I know this simply means unauthorized, but I have no authorization enable in my config file.

Howerver I can query bitcoin client using vitcoin-cli --regtest listaccounts, I get the results.

My bitcoin.conf file is pretty simple

rpcport=8332
rpcconnect=127.0.0.1
regtest=1
debug=rpc


PS: I didn't have any bitcoin.conf initially, so I create above one inside .bitcoin folder in home directory.
The RPC interface is an authenticated interface. You need to provide a username and password in order to send RPC commands. These are usually specified in the bitcoin.conf file with the rpcuser and rpcpassword options or the rpcauth option. There are also temporary RPC credentials stored in the .cookie file that can be found in the datadir.

The reason that you have no problems with bitcoin-cli is because it looks up the RPC credentials from the bitcoin.conf file or the .cookie file..