<p>There are many things that can be wrong.  More details are required, like the code you mentioned.</p>
<p>There is a more thorough discussion on this matter here:</p>
<p><a href="https://bitcoin.stackexchange.com/a/106601/113203">https://bitcoin.stackexchange.com/a/106601/113203</a></p>

CC BY-SA 4.0
2021-05-27T06:51:12.037Z
2021-05-27T06:51:12.037Z
coolshoeshine
<p>I used the following code to connect to the bitcoin core client and encountered this error:</p>
<pre><code>bitcoinrpc.authproxy.JSONRPCException: -342: non-JSON HTTP response with '401 Unauthorized' from server
</code></pre>
<p>My configuration file: bitcoin.conf is written as follows:</p>
<h1>Expose the RPC/JSON API</h1>
<pre><code>server=1
rpcbind=&quot;127.0.0.1&quot;
rpcport=8332
rpcuser=&quot;bitcoin&quot;
rpcpassword=&quot;J9JkYnPiXWqgRzg3vAA&quot;
</code></pre>
<p>May I ask what caused my code to report an error, and how should I solve this problem?</p>

CC BY-SA 4.0
2021-05-18T10:17:20.803Z
This error can depend also from the library/method that you are using to talk with the RPC interface
vincenzopalazzo
CC BY-SA 4.0
2021-10-24T11:47:03.330Z
Why do you wrap stuff on quotes needlessly?
Mercedes
<bitcoin-core>
"bitcoinrpc.authproxy.JSONRPCException: -342: non-JSON HTTP response with '401 Unauthorized' from server"
wyf
# "bitcoinrpc.authproxy.JSONRPCException: -342: non-JSON HTTP response with '401 Unauthorized' from server"

(Asked by: username_0 on 2021-05-18)

I used the following code to connect to the bitcoin core client and encountered this error:
bitcoinrpc.authproxy.JSONRPCException: -342: non-JSON HTTP response with '401 Unauthorized' from server

My configuration file: bitcoin.conf is written as follows:
Expose the RPC/JSON API
server=1
rpcbind="127.0.0.1"
rpcport=8332
rpcuser="bitcoin"
rpcpassword="J9JkYnPiXWqgRzg3vAA"

May I ask what caused my code to report an error, and how should I solve this problem?

**Tags:** bitcoin-core

> **Comments:**
> **username_1**: This error can depend also from the library/method that you are using to talk with the RPC interface  
> **username_2**: Why do you wrap stuff on quotes needlessly?  

---

## 1 answers

### Answer by username_3 on 2021-05-27. Score: 0

There are many things that can be wrong. More details are required, like the code you mentioned.

There is a more thorough discussion on this matter here:

<https://bitcoin.stackexchange.com/a/106601/113203>


---

