2

I'm using curl to request from the monero-wallet-rpc, but somehow it does not recognize the user/password. I used the following command

curl -u user:password -X POST http://127.0.0.1:8082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"getbalance"}' -H 'Content-Type: application/json'

I'm sure that the monero-wallet-rpc running correctly since I can connect throught it by using a browser, it ask for a user/password and it work.

2 Answers 2

3

Try to enable http digest authentication:

curl --digest
     -u user:password
     -X post
     -d '{"jsonrpc":"2.0", "id":"0", "method":"getbalance"}'
     -H 'content-type: application/json'
     http://127.0.0.1:8082/json_rpc
1
0

In addition to above correct answer if you use the username and password generated by the monero-wallet-rpc make sure to copy it correctly!

Example:

Starting monero-wallet-rpc with:

./monero-wallet-rpc --rpc-bind-port 18083 --wallet-file "/path/to/your/walletfile" --prompt-for-password

generates a new monero-wallet-rpc.18083.login login-credential file.

When printing the username:password combination from monero-wallet-rpc.18083.login with

cat monero-wallet-rpc.18083.login

it printed something like this for me:

monero:uAD5d089I7VEm9sJTN9epA==%

The last character % is an escape character. The password is: uAD5d089I7VEm9sJTN9epA==

This curl succeeded:

curl --digest -u monero:uAD5d089I7VEm9sJTN9epA== -X post -d '{"jsonrpc":"2.0","id":"0","method":"get_balance"}' -H 'Content-Type: application/json' http://127.0.0.1:18083/json_rpc

Note: tested on Mac with Monero 'Oxygen Orion' (v0.17.1.1-release)

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.