0

I'm working on a WebApp project which includes a system of Users. For each of these users I need a calendar of events that the user can interact with (CRUD operations). I wish to use the Google Calendar API to achieve this, however I'm uncertain about how to store the calendars for my users. The easiest way would be requiring the users to log in with a Google account, and creating a new Calendar for them. However this goes againsts requirements of the project since there is already a user system in place. What would be the best-practice way to implement this, without directly requiring users to log in with Google? The way I see it I have a couple of options:

  • Having a central service account which contains one calendar per user (Seems naive)
  • Using Googles ADMIN SDK to create Google accounts for my users behind the scenes (Is this even possible?)
  • Somehow storing the Calendars in a database myself, and mostly using Google Calendar to create and modify the event objects thereafter exporting them. (Seems unnecessarily complicated)

My backend uses Java to make the API calls to Google Calendar.

Markus B
  • 83
  • 1
  • 10

1 Answers1

0

Google calendar only supports service accounts if you have a google workspace account and can configure domain wide delegation. There is a limit to how many calendars a single user can have so assuming you create all the calendars for the users under a single user in your workspace domain. I don't think this is going to be a very robust solution in the long run your going to run out of calendars you can keep creating.

The best solution would be to have the users authorize your application to access their google calendar account and to create a calendar for them their. This will require write access to google calendar and will require you to go though the full google verification process for your application.

I question why you want to use google calendar at all and not just store the calendar data in your own system.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • Wouldn't I in that case need to write my own Calendar system? It seems more modern to me, to use an API which already has defined logic for CalendarLists, Calendars, Events, so on. Or is there a simpler solution I'm missing? – Markus B Mar 08 '23 at 07:39
  • Well using a service account to store the calendar data isnt going to allow the user to see it on the google calendar website unless you grant them permissions to it and have them login to their google account. So if you use a service account your still going to make your own UI to display the calendar data, if your going to do that anyway why not just store the data yourself. A user cant see a google calendar in the web app unless they have permissions and are logged in. – Linda Lawton - DaImTo Mar 08 '23 at 09:07
  • Yes my plan was to call get requests on the Google Calendar API in order to generate the Events into my frontend. This in itself seems simple enough, I was more worried about the time it would take to build a calendar backend from scratch (Calendar- and Event objects, along with SQL storage) and therefor wishful that Google Calendar could provide these functionalities to me. But it seems like your advice is to stay clear of calendar API as they don't provide this solution. I thank you for your input! – Markus B Mar 08 '23 at 09:26
  • Im not saying you couldnt do it im more wondering if its going to cause more issues then just coding your own backend. – Linda Lawton - DaImTo Mar 08 '23 at 09:40