I'm having some trouble with a basic API call that requires authentication using the got
library. I tried using the options
parameter to pass my username and password, but I keep getting an HTTPerror
.
Could someone please review my usage of the options
object?
const got = require('got');
(async () => {
const options = {
username: "myprojectID",
password: "thesecret"
}
try {
let raw_response = await got('https://altona.infura.io/beacon/block?epoch=1', options);
let parsed_response = JSON.parse(raw_response.body);
return parsed_response;
} catch (error) {
console.log(error);
}
})()