0
votes

I am creating a Node JS (Express) web app that will display a user's Google Calendar events, once they have logged in.

There will be multiple users, with data such as name and email address stored in a database.


Once a user has logged in, how can I retrieve a user's Google Calendar events associated to them without requiring any additional user input?

I have implemented Google's quick start sample here https://developers.google.com/google-apps/calendar/quickstart/nodejs

However this provides only access to a single authenticated user (authenticated via a terminal authentication process), with no opportunity to request a calendar of another user.

-

Question

How can I authenticate multiple users via a signup page (rather than using the nodeJS terminal) and access these google calendar events later via the data stored in a database? (Server side, with no interaction required )

Thanks

1

1 Answers

0
votes

You can try to use Domain Wide Delegation in the Service Account. It is stated here that:

If you have a Google Apps domain—if you use Google Apps for Work, for example—an administrator of the Google Apps domain can authorize an application to access user data on behalf of users in the Google Apps domain. For example, an application that uses the Google Calendar API to add events to the calendars of all users in a Google Apps domain would use a service account to access the Google Calendar API on behalf of users. Authorizing a service account to access data on behalf of users in a domain is sometimes referred to as "delegating domain-wide authority" to a service account.

Just remember that you need a service account here to enable the domain wide authority. For more information, just read this link. It also discussed here on how to create service account.