Answers for "post call with auth header and fetch"

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
0

fetch post headers

method:"POST",
body:JSON.stringify(data),
 headers:{
      "content-type": "application/json"
  }
Posted by: Guest on July-06-2021

Code answers related to "BASIC"

Browse Popular Code Answers by Language