google-auth-library-nodejs icon indicating copy to clipboard operation
google-auth-library-nodejs copied to clipboard

feat: Backwards-Compatible Auth

Open danielbankhead opened this issue 1 year ago • 1 comments

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 🦕

danielbankhead avatar Jul 28 '23 21:07 danielbankhead

do not merge added until internal proposal has been approved.

danielbankhead avatar Jul 31 '23 18:07 danielbankhead

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.

danielbankhead avatar Mar 13 '24 21:03 danielbankhead