我尝试发送帖子请求但始终获得:403
和Authentication requires
const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
const http = new XMLHttpRequest();
const url = "https://mywebsite.com/api/comment";
const params = 'comment=test';
http.open("POST", url, false, login, password);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.send(params)
如果我尝试登录,我会收到:{"status":"nok","message":"Not JSON"}
const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
const http = new XMLHttpRequest();
const url = "https://mywebsite.com/api/login";
const params = 'login=admin&password=admin'
http.open("POST", url, false);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.send(params);
我想在手动登录之前按要求更改一些数据。