通过 api 共享私人 Google 日历
Share private Google calendar via api
我正在尝试通过我的节点应用程序访问托管在 google 上的日历,但是由于我的日历需要授权,我无法通过给定的 api 查询它。
我将如何禁用 this/making 我的应用程序可访问的日历?
这是我的 api 查询:
https://www.googleapis.com/calendar/v3/calendars/heathwallace.com_gpupieshkuc85dd832m9gjrh9g@group.calendar.google.com
这是回复:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
例如,如果您查看文档 Calendars: get:您会注意到它指出
Requires authorization
现在通常情况下,如果您将某些内容设置为 public,您将能够使用 public API 密钥检索它。我将我的一个测试日历设置为 public 然后尝试使用 public API 键检索它。 (密钥和日历名称均已更改)
结果是
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
结论:您必须经过身份验证才能检索数据。使用 OAuth2 或服务帐户。通常我会建议您使用服务帐户并授予它访问相关日历的权限。由于安全问题,我不会使用 JavaScript 的服务帐户,所以我无法帮助您。
回答您的问题,您必须经过身份验证才能查看日历。没有办法解决这个问题。
您实际上可以轻松地做到这一点(不需要 Oauth)。
神奇的是在开发者控制台 console.developers.google.com 中创建一个开发者密钥(在 APIs & Auth -> Credentials -> Public Access Key -> Key for server app)
确保再次在控制台中启用日历 API (APIs & Auth -> Apis)
获取 https://www.googleapis.com/calendar/v3/calendars/heathwallace.com_gpupieshkuc85dd832m9gjrh9g%40group.calendar.google.com/events?key={YOUR_API_KEY}
我刚刚通过这种方式成功检索到了您的日历。
我正在尝试通过我的节点应用程序访问托管在 google 上的日历,但是由于我的日历需要授权,我无法通过给定的 api 查询它。
我将如何禁用 this/making 我的应用程序可访问的日历?
这是我的 api 查询:
https://www.googleapis.com/calendar/v3/calendars/heathwallace.com_gpupieshkuc85dd832m9gjrh9g@group.calendar.google.com
这是回复:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
例如,如果您查看文档 Calendars: get:您会注意到它指出
Requires authorization
现在通常情况下,如果您将某些内容设置为 public,您将能够使用 public API 密钥检索它。我将我的一个测试日历设置为 public 然后尝试使用 public API 键检索它。 (密钥和日历名称均已更改)
结果是
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
结论:您必须经过身份验证才能检索数据。使用 OAuth2 或服务帐户。通常我会建议您使用服务帐户并授予它访问相关日历的权限。由于安全问题,我不会使用 JavaScript 的服务帐户,所以我无法帮助您。
回答您的问题,您必须经过身份验证才能查看日历。没有办法解决这个问题。
您实际上可以轻松地做到这一点(不需要 Oauth)。 神奇的是在开发者控制台 console.developers.google.com 中创建一个开发者密钥(在 APIs & Auth -> Credentials -> Public Access Key -> Key for server app)
确保再次在控制台中启用日历 API (APIs & Auth -> Apis)
获取 https://www.googleapis.com/calendar/v3/calendars/heathwallace.com_gpupieshkuc85dd832m9gjrh9g%40group.calendar.google.com/events?key={YOUR_API_KEY}
我刚刚通过这种方式成功检索到了您的日历。