googleapis / googleapis/google-api-nodejs-client
API calls using Service account credentials
- Vorherrschende Sprache
- TypeScript
- Sterne
- 12.2k
- Forks
- 2k
- Ø Merge
- 1 T. 9 Std.
- Gemergte PRs (30 T.)
- 24
Beschreibung
Thanks for stopping by to ask us a question! Please make sure to include:
I am trying to make an API call using Service account credentials method in node backend
- async function main () {
const auth = new google.auth.GoogleAuth({
keyFile: 'mumzworldgoogle.json',
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: ['https://www.googleapis.com/auth/calendar.events']
});
const authClient = await auth.getClient();
// obtain the current project Id
const project = await auth.getProjectId();
// Fetch the list of GCE zones within a project.
const res = await compute.zones.list({ project, auth: authClient });
console.log(res.data);
}
router.get('/googleAPI', async (req, res) => {
main().catch(console.error);
})
I am getting an error TypeError: google.auth.GoogleAuth is not a constructor
**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response.
Beitragsleitfaden
Rechercherichtung
Es wird keine Repository-Datei und kein Test genannt. Beginne mit dem bereitgestellten Node.js-Snippet und dem Konstruktorfehler von GoogleAuth und prüfe anschließend den unterstützten Authentifizierungs-Einstiegspunkt der Client-Bibliothek für die installierte Version. Als erledigt gilt ein verifizierter API-Aufruf mit einem Service Account oder eine klar dokumentierte Reproduktion mit der relevanten Paketversion.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- node.js
- Bereich
- api, authentication, backend
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 20/100