我如何使用我的 NextJS 应用 view/edit 我的用户的 Google 日历事件

How can I view/edit my users' Google Calendar Events using my NextJS app

我正在使用 NextJS 构建一个平台,我需要在其中获取用户的 Google 日历事件并能够将事件添加到他们的日历中。

我设置了一个服务帐户,希望我的服务帐户能够访问我的用户的日历数据。

经过研究,我发现一种方法是让用户手动与我的服务帐户共享他们的日历。

但是,我想知道是否有一种方法可以让我的用户无需手动授予我的服务帐户权限,例如,在我的平台上按下一个按钮,让他们分享他们的带有服务帐户的日历。

service account are intended for use with a calendar that you the developer control. Service accounts also only work with google calendar if you have a google workspace account. You will also need to use a google workspace domain account in order to set up domain wide delegation 在您的服务帐户上以将其与 google 日历一起使用。

用户无法与服务帐户共享标准 google 日历帐户。几年前 google 关闭了它。现在唯一的选择是 domain wide delegation

也就是说,您将需要使用 Oauth2 请求您的用户同意访问他们的 google 日历帐户。像这样的东西将是一个很好的起点 Node.js quickstart