I am trying to get access to Ankr API address, which is like:
https://apis.ankr.com/XXXX/YYYY/full/main
When accessing this link by the browser I can introduce the credentials I created on Ankr panel control and I can pass successfully. However now I am trying to do this with Web3.js on Node:
var options = {
headers: [
{
name: 'Authorization',
value: 'Basic myUsername:myPassword',
},],};
const web3 = new Web3(new Web3.providers.HttpProvider('https://apis.ankr.com/XXXX/YYYY/full/main', options))
And I receive a 401 Unauthorized error response. I assume that my credentials are right because I could access them by the link on the browser, but not when passing in the header they seem not work. What is wrong in the code or what lacking of?