Questions tagged [google-api-nodejs-client]

google-api-nodejs-client is Google's officially supported node.js client library for accessing Google APIs, it also supports authorization and authentication with OAuth 2.0.

This client comes with an OAuth2 client that allows you to retrieve an access token and refreshes the token and re-try the request seamlessly if token is expired. The basics of Google's OAuth 2.0 implementation is explained on Google Authorization and Authentication documentation.

Note: This library is currently in alpha status.

The project's home page can be found on GitHub

816 questions
6
votes
1 answer

Using API key with node js google library

I am trying to consume google youtube data apis which has support for api key type of credentials. https://developers.google.com/youtube/registering_an_application I am trying to use google auth library for node js to communicate with the…
saurav
  • 5,388
  • 10
  • 56
  • 101
6
votes
2 answers

How to impersonate an admin user when using getClient() in the Google API NodeJS client

Per the recommendation in the defaultauth sample, I am trying to access the directory api for a domain which I have created a service account for. Here is the code I am attempting to connect with: import { google } from 'googleapis' const…
6
votes
1 answer

Npm module "grunt-sass" not found. Is it installed?

I am using windows 10. Have installed npm version 5.6.0,node v8.10.0 and Python 2.7. Getting grunt-sass is not installed even after installing npm using the command "npm install". After that I installed grunt using command: npm install -g…
6
votes
1 answer

Gmail API suddenly stopped working with [Error: unauthorized_client]

Where I work we use Google Apps for Work. For the last 9 months we've been using the Gmail API (~2,000 requests per day) to pull in new emails for our support email accounts. This is how we originally set it up: Go to…
6
votes
3 answers

Node.js undefined:1 [SyntaxError: Unexpected end of input]

I am getting the following error when I execute the node.js script, I tried to investigate a lot by adding console.log() to trace the error but could not find any solution. [Note: I have also searched other Stackoverflow solution but none of it…
Mahavir Munot
  • 1,464
  • 2
  • 22
  • 47
6
votes
4 answers

renaming files in Google Cloud Storage?

Can you rename files in Google Cloud Storage? I am letting users upload photos, but I want to give them the ability to edit the photo, at least by changing the name they uploaded it with. I am using Javascript through Node.js. Thanks!
6
votes
1 answer

Error 500 backendError with Gmail API and Google APIs Node Client

I'm trying to use the new Gmail API with the Google API Node client. I created a new project from the developer console, set up a new "Service Account" Client ID, and enabled access to the API. As a proof of concept, I am simply trying to list the…
Ryan
  • 605
  • 7
  • 14
5
votes
1 answer

Jest mocking google-cloud/storage typescript

I have been trying to mock the @google-cloud/storage for my implementation so that I could test it without having to hit the cloud-storge in gcp and so far it has all been in vain I have tried to mock the node_module scope folder using the jest doc…
5
votes
0 answers

How to setup google service account authorization in Node.js with JSON key file?

Trying to make use of the Server to Server OAuth flow defined here: https://developers.google.com/identity/protocols/OAuth2ServiceAccount Since I'm running from a local dev environment, I've created a service account in GCP and downloaded the JSON…
Michael
  • 1,428
  • 3
  • 15
  • 34
5
votes
2 answers

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

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…
5
votes
2 answers

Can't use proxy to do JWT authentication with googleapis

I have a NodeJS API working behind a corporate proxy and I have been trying to do authentication with Google with their NodeJS client: const google = require('googleapis'); function getServiceAccountInfo() { return { type:…
kevguy
  • 4,328
  • 1
  • 24
  • 45
5
votes
2 answers

google.gmail() is giving an error TypeError: google.gmail is not a function?

I am including a gmail.js file to do the Gmail integration on my website. But when I require gmail.js in another file, Node.js throws a typeError. I have the following code In my gmail.js file. I have used same code separately on a file and it…
5
votes
1 answer

Google People API notes

In Google's People API, is it possible to access/change contact's notes? Person definition When a contact is created https://contacts.google.com/, it is possible to set the field "Notes", that's what I'm looking for. As of now, I'm using the…
Miguel
  • 53
  • 5
5
votes
2 answers

Why google Oauth verifyIdToken (javascript nodejs version) doesn't use client-secret?

I'm testing google singin for a SPA js+nodejs app. I've added this: and these:
5
votes
2 answers

Refresh token of google api do not work properly in nodejs

I am using google api nodejs , I try to get data from google Anaytics var google = require('googleapis'); var OAuth2Client = google.auth.OAuth2; var CLIENT_ID = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; var CLIENT_SECRET = 'xxxxxxxxxxxxxxxxxxxxxx'; //var…
abhaygarg12493
  • 1,565
  • 2
  • 20
  • 40
1 2
3
54 55