basic authorization with fetch API code example
Example: how to send basic auth using fetch
fetch(url, {
...options,
headers: {
'Authorization': 'Basic ' + btoa(`${username}:${password}`)
}
})
.then(response => response.json())
.then(json => console.log(json));