Answers for "fetch javascript basic auth"

2

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));
Posted by: Guest on October-11-2020

Code answers related to "BASIC"

Browse Popular Code Answers by Language