Google Calendar: How to authenticate with Google Calendar?

Dear Coda Pack Makers.

I have recently joined Pack Studio Beta with little knowledge of coding.
The first thing I tried was mimicking CRUD operation on Google Calendar events with my own pack.

But I just keep failing authorization.
I figured out that I must use OAuth2.0 for Google API’s authorization, and also Coda seems to have OAuth2.0 support, but I can’t make it work.

Things that I have done so far is listed bellow.

  • Set up a project on Google Cloud Platform, created credentials, and got Client ID and Client Secret (But I may have made mistakes, so I am willing to start from scratch.)

If that is not too much of work, would any one of experienced coders like you help me get through this authorization phase?

This is the code I have now

import * as coda from "@codahq/packs-sdk";

export const pack = coda.newPack();

  type: coda.AuthenticationType.OAuth2,
  authorizationUrl: "",
  tokenUrl: "",
  scopes: [
  additionalParams: {
    access_type: "offline",
    prompt: "consent",
  getConnectionName: async function(context) {
    let response = await context.fetcher.fetch({
      method: "GET",
      url: ""



  name: "GetEmail",
  description: "Get the gmail address of the user.",
  isAction: true,
  parameters: [],
  resultType: coda.ValueType.String,
  execute: async function ([], context) {
    let response = await context.fetcher.fetch({
      method: "GET",
      url: ""


References that I am reading

1 Like

Hi @massive_ozone - I’m glad to hear you’re starting to try out Pack building! OAuth is one of the difficult things to get right, even for experienced software developers, so don’t feel discouraged. The code you shared looks pretty good to me, and it sounds like you’ve taken the right steps. Can you provide more information about how it’s failing? What kind of error are you getting?