我正在尝试使用nodejs获取我的Google联系人列表。
我只关注“https://github.com/google/google-api-nodejs-client/”页面上的内容,但在调用“新OAuth2”时收到错误。
简单代码
var googleapis = require('googleapis');
var OAuth2 = googleapis.auth.OAuth2,
client_id = '21486685252.apps.googleusercontent.com',
client_secret = '*********',
redirect_url = 'http://127.0.0.1:3000/auth/google/return',
oauth2Client = new OAuth2(client_id, client_secret, redirect_url);
收到错误:
TypeError: undefined is not a function
at Object.<anonymous> (C:\Program Files\nodejs\passport\google\passport-google-login.js:15:20)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
你能帮助我吗?