为什么我使用Blogger API和AngularJS获得403错误?

问题描述:

我刚刚开始掌握第三方API的构建,我想添加到我自己的网站(用AngularJS编写)中的一个功能是构建Blogger的API以创建博客提要。为什么我使用Blogger API和AngularJS获得403错误?

我已经设置好一切和我看到了200级的地位的请求,但在网络选项卡中的响应显示:

// API callback 
angular.callbacks._0({ 
"error": { 
    "errors": [ 
    { 
    "domain": "usageLimits", 
    "reason": "dailyLimitExceededUnreg", 
    "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.", 
    "extendedHelp": "https://code.google.com/apis/console" 
    } 
    ], 
    "code": 403, 
    "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup." 
} 
} 
); 

这里是我的控制器:

$http.jsonp('https://www.googleapis.com/blogger/v3/blogs/' + id + '?api_key=' + apiKey).then(function(res) { 
    $scope.blogData = res.data; 
    console.log($scope.blogData, res); 
}, function(error) { 
    console.log(error); 
}); 

所以请求通过事物的外观成功,但响应显示身份验证问题。我已阅读文档和博客将公开,所以不应该有任何秘密等问题。

任何想法?

+0

你可以尝试去到您的谷歌开发者控制台,看看你是否已经超出了您的每日配额的例子。 –

问题是url api_key中的参数。它应该只有key。 像这样工作。

$http.jsonp('https://www.googleapis.com/blogger/v3/blogs/' + id + '?key=' + apiKey).then(function(res) { 
    ... 
}, function(error) { 
    console.log(error); 
}); 

这里从文档https://developers.google.com/blogger/docs/3.0/using#RetrievingABlog

+0

是啊,解决了这个问题 - 在我发布消息后几分钟,注意到了url中的错误。 '?api_key ='是错误的。感谢您的帮助。 –