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.
CodePudding user response:
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