google-auth-library-nodejs
google-auth-library-nodejs copied to clipboard
feat: Backwards-Compatible Auth
This will greatly improve the experience for customers transitioning between different versions of google-auth-library
.
Consumers can use the new GoogleAuth.normalize
and AuthClient.normalize
APIs to ensure the provided GoogleAuth
and AuthClient
instances are compatible with the current google-auth-library
version.
Example:
// say this depends on an older version of `google-auth-library` (e.g. `v8.9.0`)
import { google } from 'googleapis';
// say this is the latest version of `google-auth-library` (e.g. `v9.0.0`)
import { GoogleAuth } from 'google-auth-library';
const auth = new GoogleAuth();
// this used to fail, but should work after internally using `instanceof GoogleAuth`.
google.options({auth});
Fixes #1402 🦕
do not merge
added until internal proposal has been approved.
This would introduce more complexity than is required to solve this problem; instead, we should encourage dependencies to expose their version of google-auth-library
so that customers can have a guaranteed, consistently working version.