2

Axios is not sending my cookies in my post requests even with “withCredentials: true”. Always get an error saying cookie “xxx” is missing. even tried "axios.defaults.withCredentials = true" Also it seems the http cookies are the ones that wont send.

axios.post('https://www.walmart.com/api/checkout/v3/contract?page=CHECKOUT_VIEW', 
{
    'affiliateInfo:com.wm.reflector': com,
    'city': "example",
    'crt:CRT': "", //this is a cookie that won't send
    'customerId:CID': "",//this is a cookie that won't send
    'customerType:type': "",//this is a cookie that won't send
    'isZipLocated': true,
    'postalCode': "example",
    'state': "example",
},
     {   headers: {
        "accept": "application/json, text/javascript, */*; q=0.01",
        "accept-encoding": "gzip, deflate, br",
        "accept-language": "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7",
        "content-type": "application/json",
        "origin": "https://www.walmart.com",
        "referer": "https://www.walmart.com/checkout/",
        "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.69 Safari/537.36",
        'inkiru_precedence': false,
        "wm_vertical_id": "0",
        "upgrade-insecure-requests": "1"
        },
})
.then(response => { 
    console.log(response)
})
.catch(error => {
    console.log(error.response)
});
maxbone
  • 21
  • 2
  • 1
    https://stackoverflow.com/questions/52549079/does-axios-support-set-cookie-is-it-possible-to-authenticate-through-axios-http https://stackoverflow.com/questions/58588976/axios-is-not-sending-cookies – adian Jul 27 '20 at 05:12

0 Answers0