为什么我在使用 Blogger API 和 AngularJS 时会收到 403 错误?

Why am I Getting a 403 Error with Blogger API and AngularJS?

我刚刚开始掌握在第 3 方 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);
});

因此从表面上看请求是成功的,但响应显示身份验证问题。我已经阅读了文档,博客将 public,所以应该没有任何秘密等问题。

有什么想法吗?

问题是 url api_key 中的参数。它应该只是 key。 这样就可以了。

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

Here an example from the documentation https://developers.google.com/blogger/docs/3.0/using#RetrievingABlog