I'm using web3 in node js to create new Web3.providers.HttpProvider with a infura project, which is configure with "Require project secret for all requests"
In infura:
https://infura.io/docs/gettingStarted/authentication
explains calling by curl is:
curl --user :YOUR-PROJECT-SECRET
https://.infura.io/v3/YOUR-PROJECT-ID
I've used:
const client = new Web3(new Web3.providers.HttpProvider('https://YOUR-PROJECT-SECRET@<network>.infura.io/v3/YOUR-PROJECT-ID');
And it doesn't work.
How can I add the --user tag and its value into new Web3.providers.HttpProvider, please?
Thanks in advance!
I'm awsering my question:
I solved it adding ":" before YOUR-PROJECT-SECRET, like this:
const client = new Web3(new Web3.providers.HttpProvider('https://:YOUR-PROJECT-SECRET@<network>.infura.io/v3/YOUR-PROJECT-ID');
It's working now!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With