Kapil Yadav
Kapil Yadav

Reputation: 780

Not able to access googleapis auth.OAuth2 for google calender api

The below code is pasted from node.js quickstart of Google calender Api section.This code is not able to access auth from google API's.I copied the error below.To see full code you can access this link .Thanks for the help.

const google = require('googleapis');
const OAuth2Client = google.auth.OAuth2;

Error looks like this :

const OAuth2Client = google.auth.OAuth2; ^
TypeError: Cannot read property 'OAuth2' of undefined

Upvotes: 2

Views: 709

Answers (1)

a5r0n
a5r0n

Reputation: 83

try it:

const {google} = require('googleapis'); const OAuth2 = google.auth.OAuth2;

Upvotes: 5

Related Questions