我正在尝试从我的后端向 linkedin 服务发送发布请求。
exports.GetAccessToken = function (req, res) {
var xhttp = new XMLHttpRequest();
var decoded = jwt.verify(req.query.jwt_token, MariaDB_config.PUB_key);
xhttp.onreadystatechange = function () { // handle request response
if (this.readyState === 4 && this.status === 200) {
console.log("answer : " + this.responseText);
}
};
xhttp.handleError()
// Send a post request
xhttp.open("POST", "https://www.linkedin.com/oauth/v2/accessToken?code=" + decoded.code + "privatestuff", true);
xhttp.send();
}
我收到以下错误:
TypeError: Cannot read property 'stack' of undefined
此方法到目前为止一直运行良好。
最佳答案
我错误地使用了“xhttp.handleError()”,我删除了它,现在它工作正常了。
关于javascript - 如何从express js服务器发送http请求?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60829125/