gax-python icon indicating copy to clipboard operation
gax-python copied to clipboard

Upgrade credentials to JWT-based credentials if appropriate

Open theacodes opened this issue 8 years ago • 0 comments

Some APIs can benefit from using JWT-based credentials over OAuth 2.0-based credentials. Those APIs should upgrade to jwt.OnDemandCredentials if they are provided an instance of google.auth.credentials.Signing.

So, for example:

credentials, _ = google.auth.default()

if isinstance(credentials, google.auth.credentials.Signing):
    jwt_credentials = google.auth.jwt.OnDemandCredentials.from_signing_credentials(credentials)

theacodes avatar Mar 29 '17 20:03 theacodes