下面是我在Node Js中的代码。每当我发出GET请求时,我都会收到Request缺少必需的身份验证凭据作为响应的信息。
代码:
var url = 'https://googleads.googleapis.com/v0/customers/myCustID?key=myKey';
var newAcessToken = getGoogleAccessToken(refresh_token);
var bearerToken = 'Bearer '+ newAcessToken;
var options = {
url: url,
headers: {
'Authorization': bearerToken,
'Accept': '*/*',
'developer-token': 'myDevToken',
},
};
request(options, function(err, response) {
if(err)
{
console.log(error);
}
else
{
console.log(response.body);
res.end();
}});