3

I am trying to build an App using Google Calendar API. I am following the guide:https://developers.google.com/calendar/quickstart/nodejs. However, when, I run the project I am getting the below error

TypeError: Cannot read property 'OAuth2' of undefined

TypeError: Cannot read property 'OAuth2' of undefined
at Object.<anonymous> (
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Function.Module.runMain (module.js:701:10)
at startup (bootstrap_node.js:194:16)
at bootstrap_node.js:618:3

Did someone faced similar issues

Dibyendu Roy
  • 93
  • 2
  • 10
  • Is this information useful for you? https://stackoverflow.com/questions/49848105/google-drive-api-cannot-read-property-oauth2-of-undefined/49848309#49848309 – Tanaike Apr 16 '18 at 21:59

1 Answers1

7

I have solved it:

const {google} = require('googleapis');
const OAuth2Client =google.auth.OAuth2;
Li Tianyi
  • 71
  • 2