Google 日历 API - 403 错误
Google Calendar API - 403 error
我正在尝试使用 Google 日历 API 设置应用程序。我设置了所有凭据并将授权 JavaScript 页面设置为等于 http://localhost:8000
,如 https://developers.google.com/google-apps/calendar/quickstart/js 快速入门指南中所建议的那样。当我尝试 运行 localhost:8000/quickstart.html
上的文件时,它将显示基础页面但没有信息。我可以单击验证按钮,它将允许我验证我的帐户以使用日历应用程序,但是不会显示任何信息。检查控制台,出现以下错误:
Get https://content.googleapis.com/calendar/v3/calendars/primary/events?maxResults=10&orderBy=startTime&showDeleted=false&singleEvents=true&timeMin=2017-08-11T20%3A58%3A29.156Z
403 ()
和
Uncaught {"error":{"errors":[{"domain":"usageLimits","reason":"accessNotConfigured","message":"Access Not Configured. Calendar API has not been used in project 440480151645 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/calendar.googleapis.com/overview?project=44080151645
then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.","extendedHelp":"https://console.developers.google.com/apis/api/calendar.googleapis.com/overview?project=44080151645
"}],"code":403,"message":"Access Not Configured. Calendar API has not been used in project 44080151645 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/calendar.googleapis.com/overview?project=44080151645
then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."}}
但是,转到提供的 link 只会说我无权访问 calendar.googleapis.com api 并且不会让我启用我的 Google 日历或使用它。
Google 日历使用 Oauth2.0 进行授权。这包括三个基本组成部分。如果缺少其中任何一项,授权将无法正常进行,您将收到 403。
- 访问令牌 - google 日历 API 将访问令牌保存到您的
/.credentials 默认文件夹。您的申请将需要
能够读取这个文件(无论它在哪里),否则你将拥有
为每个请求手动授权 API 调用。
- client_secret.json - 这是授权您的必要文件
应用程序本身 作为google 的客户端。当您使用 google 开发人员门户创建 clientID 等时,此文件是
已创建,并且还必须由您的应用程序读取。
- 范围 - 范围是您拥有的访问级别。它是由
快速入门中的默认设置为 "read-only",这可能就是为什么
你得到 403。如果你想改变范围,你要
必须编辑 both 快速入门中的代码行,或者
修改访问令牌或获取新的访问令牌以反映该更改。
我以前遇到过这个错误,但那是在我理解 Oauth2 之前。如果问题不在其中任何一个中,则可能是您在开发人员控制台中选择的内容。如果您仍然卡住,请告诉我。
基于此 thread, try setting the Referrers
to Any referrer allowed
for your project (just leave the field empty) in the Google Developers Console 如果它还不是那样的话。
为此,请转到您的 Google Developers Console 并打开 API & Auth / Credentials 并单击 Edit allowed referrers
清空输入字段。
附加参考:
- Google Calendar API v3 Access Not Configured
- 403 error with message:Access Not Configured. Please use Google Developers Console to activate the API for your project
- Access Not Configured. The API (Google+ API) is not enabled for your project. Please use the Google Developers Console to update your configuration
我正在尝试使用 Google 日历 API 设置应用程序。我设置了所有凭据并将授权 JavaScript 页面设置为等于 http://localhost:8000
,如 https://developers.google.com/google-apps/calendar/quickstart/js 快速入门指南中所建议的那样。当我尝试 运行 localhost:8000/quickstart.html
上的文件时,它将显示基础页面但没有信息。我可以单击验证按钮,它将允许我验证我的帐户以使用日历应用程序,但是不会显示任何信息。检查控制台,出现以下错误:
Get
https://content.googleapis.com/calendar/v3/calendars/primary/events?maxResults=10&orderBy=startTime&showDeleted=false&singleEvents=true&timeMin=2017-08-11T20%3A58%3A29.156Z
403 ()
和
Uncaught {"error":{"errors":[{"domain":"usageLimits","reason":"accessNotConfigured","message":"Access Not Configured. Calendar API has not been used in project 440480151645 before or it is disabled. Enable it by visiting
https://console.developers.google.com/apis/api/calendar.googleapis.com/overview?project=44080151645
then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.","extendedHelp":"https://console.developers.google.com/apis/api/calendar.googleapis.com/overview?project=44080151645
"}],"code":403,"message":"Access Not Configured. Calendar API has not been used in project 44080151645 before or it is disabled. Enable it by visitinghttps://console.developers.google.com/apis/api/calendar.googleapis.com/overview?project=44080151645
then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."}}
但是,转到提供的 link 只会说我无权访问 calendar.googleapis.com api 并且不会让我启用我的 Google 日历或使用它。
Google 日历使用 Oauth2.0 进行授权。这包括三个基本组成部分。如果缺少其中任何一项,授权将无法正常进行,您将收到 403。
- 访问令牌 - google 日历 API 将访问令牌保存到您的 /.credentials 默认文件夹。您的申请将需要 能够读取这个文件(无论它在哪里),否则你将拥有 为每个请求手动授权 API 调用。
- client_secret.json - 这是授权您的必要文件 应用程序本身 作为google 的客户端。当您使用 google 开发人员门户创建 clientID 等时,此文件是 已创建,并且还必须由您的应用程序读取。
- 范围 - 范围是您拥有的访问级别。它是由 快速入门中的默认设置为 "read-only",这可能就是为什么 你得到 403。如果你想改变范围,你要 必须编辑 both 快速入门中的代码行,或者 修改访问令牌或获取新的访问令牌以反映该更改。
我以前遇到过这个错误,但那是在我理解 Oauth2 之前。如果问题不在其中任何一个中,则可能是您在开发人员控制台中选择的内容。如果您仍然卡住,请告诉我。
基于此 thread, try setting the Referrers
to Any referrer allowed
for your project (just leave the field empty) in the Google Developers Console 如果它还不是那样的话。
为此,请转到您的 Google Developers Console 并打开 API & Auth / Credentials 并单击 Edit allowed referrers
清空输入字段。
附加参考:
- Google Calendar API v3 Access Not Configured
- 403 error with message:Access Not Configured. Please use Google Developers Console to activate the API for your project
- Access Not Configured. The API (Google+ API) is not enabled for your project. Please use the Google Developers Console to update your configuration