0

I want to use Authorization and Basic to provide credentials. How do I provide these parameters in the fetch() function?

<script>
    

    fetch('http://localhost:8080/o/headless-delivery/v1.0/sites/20121/blog-postings/', {Authorization:"Basic "+btoa('[email protected]:test') })
    .then((Response) => console.log(Response))
</script>

When I load the html page, I am getting an 403 error code in the console. Am I providing the parameters properly? What might be the problem?

I am expecting a JSON as a response.

John117
  • 31
  • 5

0 Answers0