我正在使用来自节点js的请求模块对其他api进行调用,这会抛出500错误
accessTokenStep2 : (obj,env,email,password) => {
console.log(obj);
let transId = obj.transid;
let csrfId = obj.csrfId;
let app = env.getAppUrl();
let tenant = env.getTenantId();
let policy = env.getPolicy();
let url2 = ("https://" + app + "/" + tenant + "/" + policy + "/SelfAsserted?tx=" + transId + "&p=" + policy);
var options= {
'request_type' : 'RESPONSE',
"signInName" : '************',
"password" : '******',
"g-recaptcha-response-toms" : "03AEHxwuy8mq_8jbEWU--XHGea2dF-p7F-oUmZhAgpr1Xt7XyyrzBQpJZJilwhJZPG3D-K_HldpTEEl_2Xi51xm4ICCg6-w66XfR5nE1-Cj39ytH6QZiY2yJUTy-1CJZ6qNfJBsO7EG2Kba7cSGhQgetkhAxJOBtI-FJt5WlRdjP6UHgId11rSVhSCS2kphf1Z-BO62Fu2Jm6jWxnbTiVceEVXuQTOEibtQnQ-n2ckOLI-i0GI1tFBAVi6Lu6NZkQII7m_00ZyJtSoik-1LCNNQ8GXmOxFnnVTnvm-vr3mk_RmNaLS9CT6eGlo0CfpK3DiVTLEArQDTuxY"
};
var headers = {
'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0',
'Content-Type' : 'application/xml',
'Accept' : 'application/json, text/javascript, **/*//*; q=0.01',
'X-Requested-With' : 'XMLHttpRequest',
'X-CSRF-TOKEN' : csrfId
};
return new Promise( (resolve, reject) => {
request({
url: url2,
headers:headers,
method: "POST",
form: options
}, function(error, response, body){
// console.log(error);
console.log("status code" + response.statusCode);
(response.statusCode == 200 ? resolve(body) : reject(error));
});
});
}
我尝试将数据传递给所有可用的属性,例如form,formData,body以及json true和json属性。
但仍有500次错误。