'How do I send .pem certificate in an axios request?
I'm trying to convert the following python code into javascript form so I can send the client-2048 files to the server, does anyone know how I would do this. I don't know any python and I'm struggling to find out online how I would include the username, password, headers and client-2048 files in my axios request.
import requests
#openssl x509 -x509toreq -in certificate.crt -out CSR.csr -signkey privateKey.key
payload = 'username=myusername&password=password'
headers = {'X-Application': 'SomeKey', 'Content-Type': 'application/x-www-form-urlencoded'}
resp = requests.post('https://identitysso-cert.betfair.com/api/certlogin', data=payload, cert=('client-2048.crt', 'client-2048.key'), headers=headers)
This is what I have so far, where would I include the 2048 files in this post request?
const login_endpoint = 'https://identitysso-cert.betfair.com/api/certlogin'
const login_res = await axios.post(login_endpoint, {
username: 'username',
password: 'password'
}, {
headers: {
'Accept': 'application/json',
'X-Application' : 'app_key',
'Content-Type': 'application/x-www-form-urlencoded'
}
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
