google-api-nodejs-client

Gmail API domain-wide delegation

风格不统一 提交于 2019-11-30 09:40:12
问题 I am using Gmail API and I am trying to fetch emails from all users under company. But when I run code such as: function runAPI(auth) { var gmail = google.gmail('v1'); gmail.users.threads.list({auth: auth, userId: '108800016305523828361'},'',function(err, response){ if (err) { console.log("The API returned an error: " + err); return; } var threads = response.threads; console.log(threads); }) } I get error: The API returned an error: Error: Delegation denied for xxxx@xxxxx.com In admin console

File Upload With Loopback

℡╲_俬逩灬. 提交于 2019-11-30 00:08:04
问题 I created a Simple file uploading Application with loopback. Application client side i used simple html and Java Script code . i calling a loopback api with ajax call , this is Java Script code - $('#upload-input').on('change', function () { var files = $(this).get(0).files; if (files.length > 0) { // One or more files selected, process the file upload var form = new FormData(); for (var index = 0; index < files.length; index++) { var file = files[index]; form.append('Uploded Files', file,

Gmail API domain-wide delegation

蹲街弑〆低调 提交于 2019-11-29 17:41:50
I am using Gmail API and I am trying to fetch emails from all users under company. But when I run code such as: function runAPI(auth) { var gmail = google.gmail('v1'); gmail.users.threads.list({auth: auth, userId: '108800016305523828361'},'',function(err, response){ if (err) { console.log("The API returned an error: " + err); return; } var threads = response.threads; console.log(threads); }) } I get error: The API returned an error: Error: Delegation denied for xxxx@xxxxx.com In admin console I did this: As client name I used id from the client_secret.json file. And for scope, I gave it all

Failed sending mail through google api in nodejs

点点圈 提交于 2019-11-29 17:24:25
问题 I'm trying to send an email through Google API. I'm using googleapis for Google API access in node.js . My issue is that when I try to send a simple mail with no attachments, I get the following error: 'raw' RFC822 payload message string or uploading message via /upload/* URL required I didn't define in my request that there is an attachment and I don't see any error in the email addresses. Please help. My code: var google = require('googleapis'); var gmailClass = google.gmail('v1'); var

How to get video ids from an YouTube playlist?

删除回忆录丶 提交于 2019-11-29 12:39:59
"googleapis": "^16.1.0" I have a playlist where there are two videos. How can I get the videos ids? I tried this: // Node.js const google = require('googleapis'); const youtube = google.youtube('v3'); const secrets = require('./secrets.json'); const results = youtube.playlists.list({ auth: secrets.web.api_key, part: 'id', id: 'PLvxLmGsmqdZc-GYVeLhS0N_6jfrzEleQm' }); console.log(results); Upon the code execution, I receive this: https://gist.github.com/SergeyBondarenko/ea6a2aad546ded32e4a9b3cf53228fef And there is only the playlist id: // Node.js > results.responseContent.body.items [ { kind:

Google cloud functions - cannot read property 'getApplicationDefault'

我怕爱的太早我们不能终老 提交于 2019-11-29 12:14:08
I have deployed a cloud function to invoke a dataflow pipeline template and trying to trigger the function by placing the file in cloud storage bucket. As node.js prerequisite I have done, npm init npm install --save googleapis Index.js const google = require('googleapis'); exports.goWithTheDataFlow = function(event, callback) { const file = event.data; google.auth.getApplicationDefault(function (err, authClient, projectId) { if (err) { throw err; } console.log(projectId); if (authClient.createScopedRequired && authClient.createScopedRequired()) { authClient = authClient.createScoped([ 'https:

Call Google Play Developer API from Firebase Functions

…衆ロ難τιáo~ 提交于 2019-11-28 19:43:14
I am trying to develop a server-side validation of my users' in-app purchases and subscriptions as recommended , and I want to use Firebase Functions for that. Basically it has to be an HTTP trigger function that receives a purchase token, calls the Play Developer API to verify the purchase, and then does something with the result. However, calling many of the Google APIs (including Play Developer API ) requires non-trivial authorization. Here's how I understand the required setup: There has to be a GCP project with Google Play Developer API v2 enabled. It should be a separate project, since

Send email using Google API with only access token

六眼飞鱼酱① 提交于 2019-11-28 09:29:46
I want to send an email through Google API without the unnecessary OAUTH2 parameters. I only have the access_token and the refresh_token of that user. How can I send an email through Gmail API through a basic POST request in NodeJS, with Request npm plugin? abraham is correct, but I just thought I'd give you an example. var request = require('request'); server.listen(3000, function () { console.log('%s listening at %s', server.name, server.url); // Base64-encode the mail and make it URL-safe // (replace all "+" with "-" and all "/" with "_") var encodedMail = new Buffer( "Content-Type: text

How to get video ids from an YouTube playlist?

谁说我不能喝 提交于 2019-11-28 06:21:42
问题 "googleapis": "^16.1.0" I have a playlist where there are two videos. How can I get the videos ids? I tried this: // Node.js const google = require('googleapis'); const youtube = google.youtube('v3'); const secrets = require('./secrets.json'); const results = youtube.playlists.list({ auth: secrets.web.api_key, part: 'id', id: 'PLvxLmGsmqdZc-GYVeLhS0N_6jfrzEleQm' }); console.log(results); Upon the code execution, I receive this: https://gist.github.com/SergeyBondarenko

Google cloud functions - cannot read property 'getApplicationDefault'

独自空忆成欢 提交于 2019-11-28 05:47:41
问题 I have deployed a cloud function to invoke a dataflow pipeline template and trying to trigger the function by placing the file in cloud storage bucket. As node.js prerequisite I have done, npm init npm install --save googleapis Index.js const google = require('googleapis'); exports.goWithTheDataFlow = function(event, callback) { const file = event.data; google.auth.getApplicationDefault(function (err, authClient, projectId) { if (err) { throw err; } console.log(projectId); if (authClient