在发出Cordova HTTP请求时,如何从Big Commerce获取SHOP_SESSION_TOKEN?

时间:2018-02-16 00:33:42

标签: javascript cordova bigcommerce

我正在Cordova中向Big Commerce进行以下调用,并尝试调用返回名为“SHOP_SESSION_TOKEN”的cookie:

cordovaHTTP.post('https://store-{store-hash}.mybigcommerce.com/remote.php', 
{
    w: 'expressCheckoutLogin', 
    login_email:'me@example.com', 
    login_pass:'xxxxxxxxxxx'
}, {}, 
function(response){},
function(response){}); 

当我在我的代码(而不是我想要的人)中拨打电话时,我收到一个cookie,但是当我在Postman中运行电话时,返回了42个cookie(包括我想要的那个)。

只是想知道我需要添加到我的代码中才能返回此cookie。

1 个答案:

答案 0 :(得分:1)

当您在Postman中使用Interceptor运行呼叫时,它会包含您已经在浏览器上显示的的Cookie!

如果你从chrome中清除你的cookie,然后在Postman中重新运行请求,你会看到它只返回两个cookie。

enter image description here

您可以随时通过curl获得准确的响应数据......

curl -c - -X POST https://store-hash.mybigcommerce.com/remote.php