Tag: google api

google-api-nodejs-client获取谷歌联系人

我试图让我的google联系人列表与nodejs。 我只是按照“ 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 […]

Google Calendar API Nodejs

我正在尝试使用Google Calendar API和NodeJS,因此我遵循官方教程: https : //developers.google.com/google-apps/calendar/quickstart/nodejs我来到步骤4:运行示例。 当我开始运行它时:node quickstart.js 它说: "No upcoming events found." 我不明白。 我如何访问此日历?

如何自动获取节点谷歌API的授权令牌为Gmail

我无法弄清楚如何让授权自动为用户。 我需要自动获得oauth标记,因为我的软件是所有的语音命令,但是当您尝试和检索用户电子邮件时,它会给您一个喜欢去授权的应用程序,我如何让自己的代码自动获得身份validation令牌和授权应用程序? 我试图做这个节点和angular度,以便用户的电子邮件将实时更新,如我的桌面应用程序的通知。 这是谷歌给出的示例代码,但它寻找该令牌的input。 我需要知道如何自动获取该令牌。 我只是在代码中丢失了一些东西: (function() { 'use strict'; function EmailService($window, $http, $rootScope, $q) { var service = {}; service.events = []; service.getEmail = function() { var fs = require('fs'); var readline = require('readline'); var google = require('googleapis'); var googleAuth = require('google-auth-library'); // If modifying these scopes, delete your previously saved credentials // at […]

Google Drive API只能返回一个文件

我有一个nodejs应用程序,我想要获得谷歌驱动器API中的文件列表。 我正在使用auth方法的服务帐户密钥。 我遇到的问题是,当我运行它,我只得到一个单一的文件列表(“入门”文件)。 我有4个其他文件添加在那里,但他们没有通过。 当我在谷歌api控制台中使用沙盒的方法,我得到的所有文件。 以下是我的代码。 任何想法为什么其他文件没有通过。 我试着添加更多的范围,但似乎没有帮助。 var google = require('googleapis'); var key = require('./jwt-file.json'); var jwtClient = new google.auth.JWT(key.client_email, null, key.private_key, ['https://www.googleapis.com/auth/drive'], null); var drive = google.drive('v3'); jwtClient.authorize(function(err, tokens){ if(err){ console.log(err); return; } drive.files.list({auth: jwtClient}, function(err, response){ console.log(response) }) })

Google云端硬盘API服务帐户域内

我必须使用Node.js服务器从Drive上的文件夹下载/上传/删除文件。 该文件夹位于公司的G Suite中,公司中只有less数人可以访问。 我必须使用服务帐户来执行此操作,问题是:是否有可能? 我怎样才能做到这一点? 我已经阅读https://developers.google.com/drive/v2/web/delegation和https://developers.google.com/identity/protocols/OAuth2ServiceAccount,但我不知道是否有可能授予服务帐户访问公司的域内的文件夹,因为服务帐户是@ developer.gserviceaccount.com和公司的域名是其他,所以当我尝试将该服务帐户添加到该文件夹​​时给我一个错误。 如果你能指导我,我会非常感激。 谢谢!

如何获得谷歌+用户configuration文件的细节,给出访问令牌和刷新令牌

使用谷歌API function googleLogin(req, res, next) { var google = require('googleapis'); var plus = google.plus('v1'); SCOPES = 'https://mail.google.com'; var OAuth2 = google.auth.OAuth2; var oauth2Client = new OAuth2( '215995260545-6rp2pg69olionsiugudcl4fni3o36ap9.apps.googleusercontent.com', 'xxxxxxxxxxxxxxxxxxxxxxxx', 'https://developers.google.com/oauthplayground' ); oauth2Client.setCredentials({ access_token: req.query.ac_token, refresh_token: req.query.rf_token }); plus.people.get({ userId: 'me', auth: oauth2Client }, function(err, response) { if (err) console.log(err); console.log(response); }); } 当我运行这个代码时,我得到**insufficient permission**的错误。 我错了吗? "code": […]

是一个服务帐户在node.js中查询google bigquery的正确凭据?

我在Google API Console中创build了一个服务帐户,下载了.p12文件,现在我正在尝试使用https://github.com/hokaccha/node-jwt-simple来为令牌签名。 在哪里/如何获得用HS256签名的“秘密”?

初学者node.js应用程序使用护照+ googleapis

我正在与Node.js一起尝试使用Google书籍API和护照以及Google策略进行身份validation来制作图书库应用程序。 到目前为止,我可以validation和访问API。 现在可能是一个愚蠢的问题,如何获取数据回收使用我的collections视图? 我可以在身份validation后访问Google数据,然后我需要redirect到集合,但是如何将这些数据构build到新视图中? app.get('/auth/google', passport.authenticate('google', { scope: ['https://www.googleapis.com/auth/books', 'https://www.googleapis.com/auth/userinfo.profile'] })); app.get('/auth/google/callback', passport.authenticate('google', {failureRedirect: '/'}), function (req, res) { // Successful authentication, get data and redirect to user collection googleapis.discover('books', 'v1').execute(function (err, client) { oath2Client.credentials = { access_token: req.user.accessToken, refresh_token: req.user.refreshToken }; var req1 = client.books.mylibrary.bookshelves.list().withAuthClient(oath2Client); req1.execute(function (err, bookshelves) {}); }); res.redirect('/collection'); }); app.get('/collection', routes.collection, […]

(Nodejs)Google oAuth2:缺less必需的参数:grant_type

使用Nodejs和Mikeal的请求来进行这个调用。 做所有的文档都说这里包括grant_type = authorization_code,但我仍然得到相同的错误。 查看屏幕截图,了解我传递的确切variables和方法。 以下是Grant_type首先显式设置的path /o/oauth2/token?grant_type=authorization_code&code=4%2F42sz3xxq4wGF9k9joYxRVop9mHi6.UpFaIUqZ_UQaaDn_6y0ZQNh869DgiwI&client_id=199079322117.apps.googleusercontent.com&client_secret=…&redirect_uri=…

如何使用google-api-nodejs-client为nodejs发送带有gmail api附件的邮件

我希望通过Gmail邮件发送附件。 我为node.js使用google-api-nodejs-client。 我目前的消息发送代码是: var gmailClass = google.gmail('v1'); gmailClass.users.messages.send({ auth: OAuth2Client, userId: 'me', resource: { raw: base64EncodedEmail }, } ,function(err, results) { if (!err) { //do something } else { //do something } }); 有没有办法将附件添加到发送function?