サーバーのIP(この場合は自分のコンピューターのパブリックIP)を別のサーバーにHTTPS要求で送信して、そのAPIにアクセスしようとしています。私はサーバー認証を完了し、私はベアラートークンを持っています。私はサーバー側のプログラミングにExpressとNPMを使用しています。私は私のIPアドレスを次のようにしています:要求ヘッダーにIPを送信するNPM
var ipAddress;
publicIp.v4().then(ip => {
ipAddress = ip;
console.log(ip);
});
私は私の要求を次のようにしています。
request({
//Set the request Method:
method: 'POST',
//Set the headers:
headers: {
'Content-Type': 'application/json',
'Authorization': "bearer "+ token, //Bearer Token
'X-Originating-Ip': ipAddress //IP Address
},
//Set the URL:
url: 'end point url here',
//Set the request body:
body: JSON.stringify('request body here'
}),
}, function(error, response, body){
//Alert the response body:
console.log(body);
console.log(response.statusCode);
});
}
401エラーが発生しました。私は研究をしており、IPアドレスを送信することとは何かを信じています。ヘッダーに正しく送信していますか?