I started monero-wallet-rpc on a remote server (with login and password):

./monero-wallet-rpc --rpc-bind-port 18082 --wallet-dir ./wallets_test  --rpc-login test:test --testnet  --daemon-host node.xmr.to

Then I try to connect to it through node.js

But I receive an error:

<html><head><title>Unauthorized Access</title></head><body><h1>401 Unauthorized</h1></body></html>

However, when I start monero-wallet-rpc on with same login and password it works just fine:

{ id: '0', jsonrpc: '2.0', result: {} }

P.S. When I use curl it works fine with both (remote and local) servers:

PARAMS="{\"filename\":\"test123\",\"language\": \"English\", \"password\":\"\"}"
curl \
    -u ddd:ddd --digest \
    -X POST http://$IP:$PORT/json_rpc \
    -d '{"jsonrpc":"2.0","id":"0","method":"'$METHOD'","params":'"$PARAMS"'}' \
    -H 'Content-Type: application/json'

Nodejs request example:

const request = require("request");

    forever: true,
    json: {
      jsonrpc: "2.0",
      id: "0",
      method: "create_wallet",
      params: { filename: "megatest123", password: "", language: "English" }
    auth: {
      user: "test",
      pass: "test",
      sendImmediately: false
  function(err, res, body) {

What can be the reason of such weird behaviour?

1 Answer 1


Well there seems to be quite a few open issues using that particular nodejs library with digest auth. I suggest using another library. The fact it works with curl proves this is not a Monero issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.