gRPC interceptor for OAuth 2.0 client credentials flow in Node.js. Current version is 1.2.0. This library provides a gRPC interceptor that automatically manages OAuth 2.0 token acquisition, caching, and refresh, attaching the token as a metadata bearer token. It integrates with @grpc/grpc-js and supports TypeScript. Unlike manual token management, it handles retries and token expiry transparently. It is lightweight, with no other runtime dependencies beyond the gRPC library.
npm install grpc-node-oauth2No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a gRPC interceptor for OAuth 2.0 client credentials and attaches it to a gRPC client.
Migrate to async interceptor using createInterceptor(options).
Ensure tokenUrl ends with proper path (e.g., '/token').
Always provide both retryIntervalMs and retryMaxAttempts.
If refresh token flow needed, consider alternative libraries or manual implementation.
Pass an object with required fields: clientId, clientSecret, tokenUrl, retryIntervalMs, retryMaxAttempts.
Ensure clientId is a non-empty string.
Set retryMaxAttempts to a positive integer (e.g., 10).