Public dev meeting / Google Calendar API / Using Google Calendar to insert a new event from a NodeJS application

Parent project: "Calendar and Tasks Project"

  • Summary: Part 1 of a technote where I am trying to make a NodeJS application that connects with Google Calendar API. This part covers the basic authentication.

  • Audience: developers

  • This meeting: "a07-360 — minisite - mgalli — labs — technote — Using Google Calendar API with NodeJS 225c7421-b219-41b8-ab40-a9e004179be6 Saturday, February 15⋅2:30 – 3:30pm" and ref research meeting "a07-350 — labs — calendar tasks — b5bc491d-c137-4e1c-b8ec-5580594b6144 Saturday, February 15⋅2:30 – 3:30pm"

  • Participants: Marcio S Galli

  • Text Language: en-US
  • Tags: Google Calendar, NodeJS, JavaScript

Introduction

This technote was resulted from an exploration study that I am conducting. This work consists of:

  • Learning the basics about Google Calendar API authentication, and how to perform authentication from a server-based JavaScript — using NodeJS API.

  • Learning the basics about Google Calendar API — in this case the goal is to insert a new event.

Activating Google Calendar API for you project

Once you activate, you will be directed to a Google Calendar API dashboard view for your specific app — in my case it was named "Calendar tasks".

Creating an OAUTH 2.0 Client ID access application id

Google Calendar API can be used by our app to access the Calendar of an end-user that is authenticated in a browser session. In order to act as a system (on behalf of the user) we will need to create an OAuth 2.0 Client Id using the Google API (Google API and Services) Credentials screen:

Creating a new OAuth 2.0 Client Id credential

Creating a consent screen

Download the client secret json

(Remove this) Making sure that you have credentials associated with this API

The following image shows that I have created a kind of account, a Service Account kind, that enable connections referred by Google API as server-to-server connections.

  • Draft note — I am guessing that this kind of account won't let me access my personal user calendar - which is the goal in this article.

  • Draft note — It may be the case that this account is necessary anyway, because our app will be making a connection to Google API, primarily, and then it will also access the user's calendar, on behalf of the user. Therefore, first, we should have a basic Google authentication which enables Google to know that we are a server system, as a developer. With that Google should know how to track my API access, check progress against quotas, and so on. Secondarily, as our app will access the end-user's calendar, we will end up dealing with another level of authentication.

Let's move to the NodeJS part of the story

Author
Marcio S Galli
Other writings

Made with ❤ by mGalli & MePlex