我正在使用NextJ构建平台,其中我需要获取用户的Google日历事件,并能够将事件添加到其日历中。
我设置了一个服务帐户,并希望我的服务帐户访问用户的日历数据。
研究后,我发现一种方法是让用户手动与我的服务帐户共享其日历。
但是,我想知道我的用户是否有一种方法可以授予我的服务帐户许可而无需手动执行此操作,因此,按下我的平台上的按钮可以让他们与服务帐户共享日历。
I am building a platform using NextJS in which I need to grab my users' Google Calendar events and be able to add events to their calendars.
I have a service account set up and would like my service account to access my users' calendar data.
After researching, I have found that one way to do so is to have the user share their calendar manually with my service account.
However, I was wondering if there is a way for my users to be able to give my service account permission without having to do it manually, so for example, pressing a button on my platform that will let them share their calendar with the service account.
发布评论
评论(1)
服务帐户旨在与开发人员控制的日历一起使用。服务帐户还仅在您有Google Workspace帐户的情况下使用Google日历。您还需要使用Google Workspace域帐户,才能设置域名范围委托在您的服务帐户上,将其与Google日历一起使用。
用户无法与服务帐户共享标准的Google日历帐户。几年前,Google关闭了这种情况。 域名范围
现在唯一的选择是 将需要使用OAuth2请求您的用户同意以访问其Google日历帐户。像这样的东西将是一个开始 noreferrer“> node.js QuickStart )
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 on your service account to use it with google calendar.
There is no way for a user to share a standard google calendar account with a service account. That was shut down by google a number of years ago. The only option now is domain wide delegation
That being said you will need to use Oauth2 to request consent of your users to access their google calendar accounts. Something like this would be a good place to start Node.js quickstart