Search code examples
google-apigoogle-calendar-apigoogle-oauth

how to get authorization to access a single google calendar


I have a web server which is collecting data about some kind of events. Now I would like to integrate this with google calendar. Namely I would like to have a public calendar which can be viewed by anyone and which can be written by my server application so that events collected by my server get inserted in the calendar.

I was able to register an application and to use python calendar APIs to get the authorization to access my personal calendars. However, since the server is managed by a bunch of people I would like to not give access to all my calendars but to a single one. Is that possible?


Solution

  • What you are using right now is called Oauth2, it is used to gain access to a users calendar. What you should consider is using a service account.

    Think of a service account as a dummy user it has its own google calendar account which it can read from and write to. It can also share its calendars with you so that you can view it in the web view. service accounts are basically pre-authorized so wont require your users to login to it and you will have access to everything that the service account has access to namely its calendars and any that have been shared with it.

    Check out googles tutorial on python with service accounts i also have a blog post which explains how service accounts work. Google Developer console service accounts