PhanthomD PhanthomD - 6 months ago 91
Node.js Question

How to fix Google Calendar API error

I following

But it not worked and output below this:

var clientSecret = credentials.installed.client_secret;

TypeError: Cannot read property 'client_secret' of undefined
at authorize (/Users/prangyy/myApp/quickstart.js:32:43)
at processClientSecrets (/Users/prangyy/myApp/quickstart.js:21:3)
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:404:3)


Try checking your client_secret.json in the Node.js Quickstart.

It should contain clientID, auth_url, token_uri, auth_provider_x509_cert_url, client_secret, redirect_uris, javascript_origins.


if not yet, follow this to get your client_secret.json file

  1. Use this wizard to create or select a project in the Google Developers Console and automatically turn on the API. Click Continue, then Go to credentials.
  2. At the top of the page, select the OAuth consent screen tab. Select an Email address, enter a Product name if not already set, and click the Save button.
  3. Select the Credentials tab, click the Create credentials button and select OAuth client ID.
  4. Select the application type Other, enter the name "Google Calendar API Quickstart", and click the Create button.
  5. Click OK to dismiss the resulting dialog.
  6. Click the file_download (Download JSON) button to the right of the client ID.
  7. Move this file to your working directory and rename it client_secret.json.

I hope this helps. Goodluck :)