Fetch with post method returns 401 (works with postman)

Hi I’m truing to do this but keep getting 401 although same credentials work in postman… anyone have an idea?? This is the backend call:

fetch(URL, {
method: ‘POST’ ,
headers: 'Authorization: Basic ’ + base64( ‘User:ApiKey’ ),
body: JSON.stringify(myBody)
}).then(httpResponse => {
console.log( "httpResponse: " + httpResponse.status)});

Hi,
Notice that the “headers” field should contain an object, as described in the documentation here , if you are still struggling please share the request URL, body and the error message as well.

perfect thanks, worked like a charm