I'm very new to JavaScript so I'm hoping this is not a stupid question.
I have searched this site and the internet but cannot find the answer. I am trying to replicate a Python request.get() (which is working) in a JavaScript request. The python is:
requests.get(url, auth=(username, password), cert="path/to/certificate.pem")
My JavaScript is as follows currently:
fetch(url, {
headers: {
Authorization: `Basic ${btoa(username + ":" + password)}`
},
method: GET
})
How do I load the .pem certificate into the request?
Many thanks.
EDIT:
My apologies @Random Davis I thought specifying I'd searched this site was enough of an indication I hadn't found anything I was looking for. Please see below and the edited title.
To clarify I am not using node.js. Or at least I am unaware that I am using it as I am just utilising local files (HTML/CSS/JavaScript). As far as I can tell every single other answer here is node.js related and requires importing(??requiring??) external libraries. I am trying to avoid this.
Obviously if it is not possible without node.js and the external libraries I will have to think about using them. Due to my lack of knowledge with the JS/Node stack I am unaware if these requests can be done with just vanilla JS.
Again may thanks for any help.