Google OAuth TypeError:无法读取未定义的属性“OAuth2" [英] Google OAuth TypeError: Cannot read property 'OAuth2' of undefined

查看:37
本文介绍了Google OAuth TypeError:无法读取未定义的属性“OAuth2"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Google Calendar API 构建应用程序.我正在遵循指南:https://developers.google.com/calendar/quickstart/nodejs.但是,当我运行该项目时,出现以下错误

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: 无法读取未定义的属性OAuth2"

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

推荐答案

我已经解决了:

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

这篇关于Google OAuth TypeError:无法读取未定义的属性“OAuth2"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆