google-api-nodejs-client

“Socket Hang Up” / ECONNRESET Error while uploading to Google Cloud Storage

拜拜、爱过 提交于 2020-01-06 07:00:46
问题 We're using Google Cloud Storage to store pictures uploaded by our users. For some reason, it stopped to work today. var googleapis = require('googleapis'); var GoogleAuth = require('google-auth-library'); var googleAuth = new GoogleAuth(); var authClient = new googleAuth.JWTClient( accountEmail, keyFile, null, 'https://www.googleapis.com/auth/devstorage.read_write' ); authClient.authorize(function (err) { // Error here: { [Error: socket hang up] code: 'ECONNRESET' } }); So it seems like I

Missing required field: member

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-05 06:38:26
问题 { errors: [ { domain: 'global', reason: 'required', message: 'Missing required field: member' } ], code: 400, message: 'Missing required field: member' } I get this error when I run the following request: var request = client.admin.members.insert({ groupKey: "some_group@example.com" , email: "me@example.com" }); I was authenticated successfully (I received the access token and so on) but when I execute the request above it callbacks that error. What member field am I supposed to add? It works

Google Analytics Reporting API returning empty object - NodeJs

浪子不回头ぞ 提交于 2020-01-05 04:06:11
问题 first question so bear with me. I am using NodeJS to query the Google Analytics Reporting API. I am able to receive the OAuth 2 token I need, and when I query the API I get a 200 response back. However the payload that returns is an empty object instead of the JSON formatted report response that is the intended goal. var https = require('https'); var google = require('googleapis'); var key = require('path/to/key'); var jwtClient = new google.auth.JWT(key.client_email,null,key.private_key,

How to send multipart/mixed request for google indexing batch request in NodeJs?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-01 05:37:06
问题 I am using Nodejs to connect with GoogleApis v35.0.0 to tell Google to update or remove pages from the Google index. And I stuck in the multipart/mixed request, the body of multipart when I send the request through Google indexing batch request. I could able to send an individual page update request to Google by following the indexing API documentation. But since Google has the limited quota at maximum of 200 requests per day and I need to update more URL's than that. So, I am trying to use

how to use the refreshAccessToken method to generate a new accesstoken in google-api-nodejs-client

浪子不回头ぞ 提交于 2019-12-31 01:34:53
问题 I see that this pull request adds a method to refresh the access token using a saved refresh token. It is not clear to me how to use it. I have saved the tokens (including the refresh token) from the original getToken request and am now retrieving the token from the Database in a new session. How do I set the credentials on OAuth2Client so that I can call refreshAccessToken and get a new accesstoken? 回答1: I had missed the paragraph on setting credentials on the github readme, so here is some

Google OAuth2 API Refresh Tokens

落爺英雄遲暮 提交于 2019-12-30 05:15:06
问题 I'm using the google-auth-library-nodejs library to integrate into a number of GMail accounts, to get lists of emails. My process flow is simple: 1) Try to authorize the client, using this function: function _authorise(mailBox, callback) { let auth = new googleAuth(); let clientId = eval(`process.env.GMAIL_API_CLIENT_ID_${mailBox.toUpperCase()}`); let clientSecret = eval(`process.env.GMAIL_API_CLIENT_SECRET_${mailBox.toUpperCase()}`); let redirectUri = eval(`process.env.GMAIL_API_REDIRECT_URI

When OAuth2 Google API script is called from other script, it is not possible to validate it

試著忘記壹切 提交于 2019-12-25 09:06:04
问题 Whenever OAuth2 Google API script is called for the first time it requires authentication. node googleAPIscript.js It simply provides link and asks for input. The given link contains generated string that should be pasted into the input. Now that is an issue when that script is first called from other script written in different language. I have a PHP web script that executes Google API Node script such as: echo exec('node googleAPIscript.js'); And the output string looks like this: Enter the

Google Calendar API service token only has reader accessRole

血红的双手。 提交于 2019-12-25 07:08:11
问题 I'm accessing the Google Calendar API and authenticating with a service token to a calendar owned by an apps-for-domains account. When I call calendar.events.list, I get the response: { kind: 'calendar#events', etag: [snip], summary: [snip], description: [snip], updated: '2014-11-16T12:33:06.434Z', timeZone: 'Europe/London', accessRole: 'reader', <------ this is the problem defaultReminders: [], nextSyncToken: [snip], items: [] } I would like to be able to write to the calendar. The token's

Google Calendar API service token only has reader accessRole

随声附和 提交于 2019-12-25 07:07:02
问题 I'm accessing the Google Calendar API and authenticating with a service token to a calendar owned by an apps-for-domains account. When I call calendar.events.list, I get the response: { kind: 'calendar#events', etag: [snip], summary: [snip], description: [snip], updated: '2014-11-16T12:33:06.434Z', timeZone: 'Europe/London', accessRole: 'reader', <------ this is the problem defaultReminders: [], nextSyncToken: [snip], items: [] } I would like to be able to write to the calendar. The token's

gmail with multiple attachments not working

江枫思渺然 提交于 2019-12-25 02:59:27
问题 When mail is sent with multiple attachments using gmail api, mail is not going properly. Attachments are not going in mail, instead some code is going in mail. I am using node js and request-promise module for achieving this. I have tried sending attachments by setting boundaries on attachments. Here is the piece of code that I have written. let user = await db.model('User').findOne({ _id: userId }); let from = user.crmOptions.email; let mailString = ''; for (let i in req.files) { mailString