Answer the question
In order to leave comments, you need to log in
Problem with Node.js Quickstart. Cannot read property 'OAuth2' of undefined. How to decide?
I do everything according to the instructions https://developers.google.com/sheets/api/quickstar...
when calling quickstart.js it gives an error:
C:\Users\Admin\quickstart.js:4
const OAuth2Client = google.auth.OAuth2 ;
____________________________________^
TypeError: Cannot read property 'OAuth2' of undefined
at Object. (C:\Users\Admin\quickstart.js:4:34)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module. load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10 )
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
What could be the problem?
Answer the question
In order to leave comments, you need to log in
Because the structure of googleapis has changed a bit. It will be right:
const google = require('googleapis').google;
const OAuth2 = google.auth.OAuth;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question