node-fetch auth basic

JavaScript
fetch(url, {
	...options, 
	headers: {
    	'Authorization': 'Basic ' + btoa(`${username}:${password}`)
    }
})
.then(response => response.json())
.then(json => console.log(json));// for node-fetch

fetch(url, {
	... 
	headers: {
    	'Authorization': 'Basic ' + Buffer.from(`${username}:${password}`, 'binary').toString('base64')
    }
    ...
})

Source

Also in JavaScript: