服务帐户 - JWT - 节点 Google Calendar API - 事件:观看 - 将每个事件显示为私有时它不是

问题描述 投票:0回答:0

我正在做一个项目来集成和同步我公司的谷歌和 NetSuite 日历。我正在使用 Google APIs Node.js 客户端。我一直在使用 OAuthClient,直到今天我终于能够设置一个具有全域授权的服务帐户并开始使用 JWT 进行身份验证。

我知道它对我正在测试的一些员工的 CRUD 操作正常工作,所以我没有理由相信它在那里设置不正确。

但是,我在让“观看”事件按预期工作时遇到了问题(我在 OAuthClient 中没有遇到这个问题)。同步适用于 nextSyncToken 和其他一切,但使用服务帐户和 JWT 身份验证,即使我在 Google 日历中将它们设置为公开,所有事件都将作为“私有”返回。 OAuthClient 不是这种情况。

我认为这是一个权限问题,即使服务帐户具有域范围的委托并且似乎对我们的员工日历具有完全的 CRUD 访问权限。

除了身份验证方法之外,代码没有什么不同,它适用于 Watch webhook 之外的所有内容。

以下是 Watch with OAuthClient 的示例响应:

{"kind":"calendar#event","etag":"\"exampleEtag\"","id":"exampleId","status":"confirmed","htmlLink":"https://www.google.com/calendar/event?eid=exampleEID","created":"2022-06-20T16:08:27.000Z","updated":"2022-06-20T18:58:29.919Z","summary":"exampleSummary","creator":{"email":"[email protected]"},"organizer":{"email":"[email protected]"},"start":{"dateTime":"2027-01-05T13:00:00-06:00","timeZone":"exampleTimeZone"},"end":{"dateTime":"2027-01-05T14:00:00-06:00","timeZone":"exampleTimeZone"},"recurringEventId":"exampleEventId","originalStartTime":{"dateTime":"2027-01-05T13:00:00-06:00","timeZone":"exampleTimeZone"},"iCalUID":"[email protected]","sequence":0,"attendees":[{"email":"[email protected]","self":true,"responseStatus":"accepted"},{"email":"[email protected]","organizer":true,"responseStatus":"accepted"}],"extendedProperties":{"shared":{"meetingId":"exampleId","meetingParams":"{\"topic\":\"exampleTopic\",\"type\":3,\"invitees_hash\":\"exampleHash\"}"}},"conferenceData":{"entryPoints":[{"entryPointType":"video","uri":"https://example.com/j/example?pwd=example","label":"example/p/example?pwd=example","meetingCode":"example","passcode":"example"},{"regionCode":"US","entryPointType":"phone","uri":"tel:+555555555,,85555555#","label":"+15555555","passcode":"5555"},{"entryPointType":"more","uri":"https://www.google.com/url?q=https://applications.example.com/addon/invitation/detail?example"}],"conferenceSolution":{"key":{"type":"addOn"},"name":"example","iconUri":"https://lp8.googleusercontent.com/example"},"conferenceId":"5555555","notes":"Meeting host: <a href=\"mailto:[email protected]\" target=\"_blank\">[email protected]</a>","parameters":{"addOnParameters":{"parameters":{"scriptId":"exampleScriptId","realMeetingId":"Example","creatorUserId":"example","meetingUuid":"example","meetingType":"9","originalEventId":"example"}}}},"reminders":{"useDefault":true},"eventType":"default"}

这是我通过服务帐户和使用 JWT 身份验证(绝对不是私有的)得到的:

[{"kind":"calendar#event","etag":"\"5555555555\"","id":"exmapleID","status":"confirmed","htmlLink":"https://www.google.com/calendar/event?eid=exampleEID","updated":"2023-03-30T22:22:28.249Z","start":{"dateTime":"2023-03-30T19:00:00-05:00","timeZone":"exampleTimeZone"},"end":{"dateTime":"2023-03-30T20:00:00-05:00","timeZone":"exampleTimeZone"},"visibility":"private","iCalUID":"[email protected]"}]


我已经多次阅读文档,并尝试找到使用服务帐户和 JWT 身份验证与事件的人的好例子:观看 API 调用。他们似乎几乎没有任何东西可供我用作资源。对于这个特定的 Google Calendar API 调用,资源似乎相当有限。再次(事件:观看)。

api jwt calendar
© www.soinside.com 2019 - 2024. All rights reserved.