This is Google's officially supported client library for Node.js, providing comprehensive functionality for OAuth 2.0 authorization and authentication with Google APIs. It abstracts away the complexities of credential management, offering various authentication flows including Application Default Credentials (ADC), OAuth2 for user consent, JSON Web Tokens (JWT) for service-to-service communication, and direct access for Google Compute environments. The library is currently at version 10.6.2 and undergoes continuous development, with regular bug fixes and feature enhancements released typically on a monthly basis, as evidenced by recent changelog entries from March and February 2026. Key differentiators include its robust support for workload and workforce identity federation, impersonated credentials, and downscoped clients, making it suitable for a wide array of use cases from local development to complex multi-cloud deployments. It ships with TypeScript types, ensuring a typed developer experience.
npm install google-auth-libraryVerified import paths — ran on the pinned version, not inferred.
Installs the library and authenticates using Application Default Credentials (ADC) to obtain and verify an access token.
Upgrade your Node.js environment to version 18 or a more recent LTS release (e.g., using nvm: `nvm install 18 && nvm use 18`).
For new projects or modern Node.js environments, use ES Module `import` syntax (e.g., `import { Class } from 'pkg';`). Ensure your `package.json` specifies `"type": "module"` for ESM projects.Rely solely on the public API of `google-auth-library` for token management and generation. Avoid direct interaction with internal `gtoken` implementations.
Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the path of your service account key file, run `gcloud auth application-default login`, or ensure your application is deployed on a Google Cloud environment that provides default credentials.
Review and update custom proxy agent configurations to be compatible with the latest `http-proxy-agent` versions. Ensure any custom agent factories are correctly exporting constructors or objects as expected by updated dependencies.
Upgrade your Node.js runtime to version 18 or higher. For example, using nvm: `nvm install 18 && nvm use 18`.
If your project is ESM, ensure `"type": "module"` is set in `package.json` and use `import` statements. If CommonJS, verify no conflicting ESM configurations.
Authenticate using `gcloud auth application-default login`, set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to a service account key file path, or ensure your application runs within a Google Cloud environment with associated service accounts.