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));
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));
fetch with bearer token
fetch('URL_GOES_HERE', {
method: 'post',
headers: new Headers({
'Authorization': 'Basic '+btoa('username:password'),
'Content-Type': 'application/x-www-form-urlencoded'
}),
body: 'A=1&B=2'
});
fetch post headers
method:"POST",
body:JSON.stringify(data),
headers:{
"content-type": "application/json"
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us