我正在尝试对 blogger.com 进行 ajax 调用。该调用检索用户的数据。我使用这个https://developers.google.com/blogger/docs/3.0/作为参考。以下是我写的ajax。
var getUserDetail = function(){
var url = "https://www.googleapis.com/blogger/v3/users/self";
$.ajax({
url: url,
type: 'GET',
beforeSend: function (request)
{
request.setRequestHeader("Authorization","oauth_token_I_got");
},
}).done(function(data) {
console.log(data)
},"json");
}
每当我尝试拨打电话时都会收到 401 错误
进一步追踪错误
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
我哪里错了?谢谢