Invalid response received: 401; project id required

Hello,
I have just signed up and created a project. I would like to connect to ETH mainnet with web3j. I copied the endpoint provided in the project setting, which looks like:

https://PROJECT_ID:PROJECT_SECRET@eth2-beacon-mainnet.infura.io

However, when initializing web3j with the endpoint, I get the following error:

org.web3j.protocol.exceptions.ClientConnectionException: Invalid response received: 401; project id required

at org.web3j.protocol.http.HttpService.performIO(HttpService.java:173)
at org.web3j.protocol.Service.send(Service.java:48)
at org.web3j.protocol.core.Request.send(Request.java:87)
at ste.w3.easywallet.Wallet.balance(Wallet.java:35)
at ste.w3.easywallet.WalletTest.get_wallet_balance(WalletTest.java:17)

[…]

how should I format the endpoint?

many thanks in advance.

1 Like

I figured it out: I created an ETH2 project instead of a Ethereum project…

1 Like

Hi @sirste and welcome to our Infura community.

Thanks for letting us know. If you still have any questions please come back to us. We’re here to help.

1 Like