How to Securely Use Project Secret With Nodejs?

What is the best practice for authenticating with a project secret? Should I be using http-auth?

The example in the documentation is for curl only.

Hi @Genys, here’s another example in Python using the requests library. We are actively working to build out more tutorials and examples for our docs, is there any other use cases you’re interested in learning more about?

payload = {"jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 1}
response =, json=payload, headers=ethheader, auth=HTTPBasicAuth(infura_id, infura_secret))
response_json = response.json()['result']
1 Like