トークンとヘッダーを送信してAPIから応答を返そうとしていますが、私はしません私はどこに置くべきかを知っている。npmはトークンとヘッダー 'content-type'を同時に送信します: 'application/json'を同時に呼び出します
これは、これまでの私のコードです:
var request = require('request');
request.get('google example url', {
//
'auth': {
'bearer': '15252727282'
},
"headers": {
"Content-Type": "application/json"
}
}, function (error, response, body) {
console.log('error:', error); // Print the error if one occurred
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
console.log('body:', body);
});
は、これは私が戻って私のコンソールで取得していますものです:
error: null
statusCode: 401
body: HTTP Token: Access denied.