[英]Why am I Getting a 403 Error with Blogger API and AngularJS?
我刚刚开始着手建立在3rd Party API之上,而我想添加到我自己的网站(用AngularJS编写)中的一个功能是基于Blogger的API来创建博客供稿。
我已经完成所有设置,并且看到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);
});
因此,从外观上看,请求是成功的,但是响应显示了身份验证问题。 我已经阅读了文档,该博客将公开发布,因此秘密等问题不应该存在。
有任何想法吗?
问题是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中的示例
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.