将csrf令牌从nodejs传递给第三方

时间:2017-08-10 09:47:18

标签: node.js rest azure xmlhttprequest http-post

试图将params和标题传递给azure api,真的不确定出了什么问题:(,返回500错误。

    let transId = obj.transid;
    let csrfId = obj.csrfId;

    console.log(obj);
    //let app = env.getAppUrl();
    //let tenant = env.getTenantId();

    let app = "qa-id.test.subway.com";
    let tenant = "28fe2ff7-021a-4e9d-a713-1baa341c71d7"; 
    let policy = "B2C_1A_signup_signin-r2"; 
    //let policy = env.getPolicy();
    let url2 = ("https://" + app + "/" + tenant + "/" + policy + "/SelfAsserted?tx=" + transId + "&p=" + policy);

    var options = {
        'request_type'              : 'RESPONSE',
        'signInName'                : 'UrsulinaCumpsty@qasubway.com',
        'password'                  : 'Subway1234',
        'Authorization'             :  csrfId,
        'g-recaptcha-response-toms' : '03AEHxwuy8mq_8jbEWU--XHGea2dF-p7F-oUmZhAgpr1Xt7XyyrzBQpJZJilwhJZPG3D-K_HldpTEEl_2Xi51xm4ICCg6-w66XfR5nE1-Cj39ytH6QZiY2yJUTy-1CJZ6qNfJBsO7EG2Kba7cSGhQgetkhAxJOBtI-FJt5WlRdjP6UHgId11rSVhSCS2kphf1Z-BO62Fu2Jm6jWxnbTiVceEVXuQTOEibtQnQ-n2ckOLI-i0GI1tFBAVi6Lu6NZkQII7m_00ZyJtSoik-1LCNNQ8GXmOxFnnVTnvm-vr3mk_RmNaLS9CT6eGlo0CfpK3DiVTLEArQDTuxY'

    };

    var cheaders = {
          'User-Agent'          :  'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0',
          'Content-type'        : 'application/x-www-form-urlencoded',       
          'Accept'              : 'application/json, text/javascript, **/*//*; q=0.01',
          'X-Requested-With'    : 'XMLHttpRequest',
          'X-CSRF-TOKEN'        :  csrfId
        };

        var args = {
            form: options,
            headers: cheaders
        };



 return new Promise( (resolve, reject) => {

    //console.log(url2);

        client.post(url2, args, function (data, response) {
                console.log(response.statusCode);
                (response.statusCode == 200 ? resolve(data) : reject(response.error));
            });



 });

我们将不胜感激,是否将csrf令牌传递给第三方表格节点js?

我们将不胜感激,是否将csrf令牌传递给第三方表格节点js?

0 个答案:

没有答案