googleapis_auth icon indicating copy to clipboard operation
googleapis_auth copied to clipboard

Refactor Platform.environment call in MetadataServerAuthorizationFlow for Node.js usage

Open CosmicPangolin opened this issue 4 years ago • 0 comments

One meaningful use-case platform is Node.js (eg. calling google arbitrary Google APIs using Firebase Functions interop library). It would be nice to be able to call clientFromMetadataServer in these Cloud Functions, which seems precluded only by the following line in MetadataServerAuthorizationFlow:

final metadataHost = Platform.environment[_GCE_METADATA_HOST_ENV_VAR] ??
        _DEFAULT_METADATA_HOST;

Is it possible to protect the Platform.environment call so that this function doesn't error on Node?

CosmicPangolin avatar Mar 24 '20 16:03 CosmicPangolin