Tag: 谷歌的API 的NodeJS客户端

获取Google Drive NodeJS客户端的上传进度?

我们从req = drive.files.insert获取请求对象后如何使用它查找file upload进度? 我通过多次调用req stringsearch它,但无济于事。 function uploadFile(){ var path = untildify("~/workspace/incomplete/aw.jpg"); var drive = google.drive('v2'); var req = drive.files.insert({ resource: { title: 'aw.jpg' }, media: { body: fs.createReadStream(path) }, auth: oauth2Client }, function(err, response) { if (err) console.log(err); // else // console.log(response); }); console.log(req); }

使用从客户端接收到的谷歌授权代码在服务器端获取访问令牌javascript(nodejs)

我已经通过这个文档: – https://developers.google.com/identity/sign-in/web/server-side-flow 在最后一步它会收到授权码,然后显示使用java或python库接收访问令牌和刷新令牌的例子,但是我无法在nodejs中find任何类似的例子。 我怎样才能复制使用nodejs相同的例子? 我不能只发送一个post或获得一些谷歌oauth api的请求,并使用授权码接收访问令牌? 提前致谢 :)

如何撤销由OAuth从谷歌提供的令牌? 的NodeJS

我已经通过使用oauth2从我的NodeJS应用程序连接到谷歌加,但如何撤销令牌/断开? 我不能在NodeJS的文档中find任何东西。

从NodeJS(或云function)获取GCE实例的临时IP

我遇到麻烦findNodeJS API访问任一: 当前分配的临时IP和相关实例名称的列表,或者 一个实例的短暂的IP,如果我已经知道它的名字。 我正在运行一个云端函数,它需要能够检查一组给定的基本实例名称的临时IP地址是否发生变化。 请注意,实例是由实例组创build的。 我没有问题获取有关在我的函数中插入/删除的实例的信息,但我找不到任何方式来检索与实例关联的外部IP。

使用访问令牌在节点中获取Google +用户个人资料

我正在尝试在Node中获取用户configuration文件的详细信息。 stream程是这样的,我有一个移动应用程序,为我生成令牌(通过谷歌加本地SDKauthentication),然后我把令牌发送到我的节点服务器,我想从谷歌获得有关用户的详细信息。 我尝试了以下(假设我有从客户端access_token ): var request = require('request'); request('https://www.googleapis.com/oauth2/v2/userinfo?access_token=' + access_token, function(err, res, body) { if (err) return callback(err); if (res.statusCode != 200) { return callback(new Error('Invalid access token: ' + body)); } else { var me; try { me = JSON.parse(body);} catch (e) { return callback(new Error('Unable to parse user data: ' + e.toString())); […]

NodeJS Google API客户端:我如何知道访问令牌已过期?

我正在使用Nodejs Google API客户端Oauth进程。 我遵循oauth的代码示例, https://github.com/google/google-api-nodejs-client/blob/master/examples/oauth2.js 。 我有一个问题。 如何检查访问令牌是否过期,以及如何使用刷新令牌再次获取另一个访问令牌? 更具体地说,让我们说访问谷歌+用户configuration文件,所以我使用访问令牌来获取用户configuration文件: getAccessToken(oauth2Client, function() { // retrieve user profile getUserProfile(client, oauth2Client, 'me', function(err, profile) { if (err) { console.log('An error occured', err); return; } console.log(profile.displayName, ':', profile.tagline); }); }); 此外,在应用程序的客户端(backbonejs),如果我正在尝试使用谷歌API的JS客户端访问谷歌驱动器API(不谷歌加),我不知道我是否可以使用我得到的访问令牌应用程序(nodejs)的服务器端,或者我必须使用谷歌api JS客户端做另一个OAuth。

如何刷新Google Analytics(分析)报告API v3的访问令牌

所以我正在研究一个Node.js应用程序,它将调查Google Analytics(分析)API的x秒数量。 我已经设置了一个“服务帐户”,并将p12键转换为一个.pem文件。 初始设置看起来像这样: var authClient = new google.auth.JWT(authData.serviceEmail, authData.keyFile, null, authData.scope, ''); authClient.authorize(function(err, tokens) { if (err) { winston.log('error', 'Error authorizing with GA', {error: err}); return; } setInterval(function() { analytics.data.realtime.get({ 'auth': authClient, … }, function (err, body) { // getting 401 error here }) }, 20000); }); 我还没有意识到最初的代币有1个小时的到期date; 但是我收到的令牌看起来像这样: { access_token: …, token_type: 'Bearer', […]

在Google云端存储中使用nodejs gcloud api移动/重命名文件夹

我正尝试使用gcloud api重命名或移动Google云端存储中的文件夹。 类似的问题解释了如何删除文件夹: 使用nodejs gcloud api删除Google云端存储中的文件夹 但是,如何重命名一个文件夹? 或移动到另一个path?

用browserify捆绑google-api-nodejs-client不起作用

我正在尝试用google-api-nodejs-client使用browserify构build客户端应用程序。 看起来像在里面试图读取一些MIMEtypes信息使用FS模块,并没有在浏览器中做到这一点。 // Load additional types from node.js community mime.load(path.join(__dirname, 'types/node.types')); // Default type mime.default_type = mime.lookup('bin'); 有没有人使用这个API进行客户端开发?

如何使用Nodejs插入到BigQuery?

我想使用google-api-nodejs-client将行stream传输到Google BigQuery 。 挖掘源代码我发现我需要一个“资源”参数。 我尝试了几种组合,并去apirequest的来源,但我总是得到错误No rows present in the request. 我终于成功地与另一个npm模块一次上传一行,但是这个模块不支持tabledata.insertAll()。 你可以给一个例子,说明如何使用“资源”参数来stream插入? bigquery.tabledata.insertAll({ auth: oauth2Client, 'projectId': config.google.projectId, 'datasetId': config.google.datasetId, 'tableId': config.google.tableId, 'resource ': { "kind": "bigquery#tableDataInsertAllRequest", "rows": [ { "insertId": 123456, "json": '{"id": 123,"name":"test1"}' } ] } }, function(err, result) { if (err) { return console.error(err); } console.log(result); });