Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service to service example code not working #1782

Closed
q42jaap opened this issue Jul 31, 2019 · 4 comments
Closed

Service to service example code not working #1782

q42jaap opened this issue Jul 31, 2019 · 4 comments
Assignees
Labels
type: docs Improvement to the documentation for an API.

Comments

@q42jaap
Copy link

q42jaap commented Jul 31, 2019

The example code in the readme:

const auth = new google.auth.GoogleAuth({
    // Scopes can be specified either as an array or as a single, space-delimited string.
    scopes: ['https://www.googleapis.com/auth/compute']
  });

Is not working, the runtime error is:

TypeError: google.auth.GoogleAuth is not a constructor

It's not clear how to solve this.

@JustinBeckwith JustinBeckwith added the type: docs Improvement to the documentation for an API. label Jul 31, 2019
@bcoe
Copy link
Contributor

bcoe commented Jul 31, 2019

@q42jaap we hadn't yet published version 42.0.0 of the library, which introduces the GoogleAuth constructor.

Could you please npm i googleapis@latest, and let me know if this solves your problem?

@jlippold
Copy link

Im using 42.0.0 and getting the same error, I have no idea why

@bcoe
Copy link
Contributor

bcoe commented Aug 12, 2019

@jlippold @q42jaap I have just confirmed that the following code works:

const {google} = require('googleapis');
const auth = new google.auth.GoogleAuth({
  // Scopes can be specified either as an array or as a single, space-delimited string.
  scopes: ['https://www.googleapis.com/auth/compute']
});

On googleapis@42.0.0.

@jlippold try rm -rf node_modules; rm package-lock.json; npm i, and give the example code a shot.

If you're continuing to have issues, mind sharing a snippet of the code you're running?

@ryanpoh
Copy link

ryanpoh commented Jan 7, 2021

It doesnt work for me too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: docs Improvement to the documentation for an API.
Projects
None yet
Development

No branches or pull requests

5 participants