def to_jwt_credentials(self): """Creates a :cls:`google.auth.jwt.Credentials` instance from this instance. The new instance will use the same private key as this instance and will use this instance's service account email as the issuer and subject. This is the same as calling :meth:`jwt.Credentials.from_service_account_file` with the same file used to create these credentials:: svc_creds = service_account.Credentials.from_service_account_file( 'service_account.json') jwt_from_svc = svc_credentials.to_jwt_credentials() # is the same as: jwt_creds = jwt.Credentials.from_service_account_file( 'service_account.json') Returns: google.auth.jwt.Credentials: A new Credentials instance. """ return jwt.Credentials(self._signer, issuer=self._service_account_email, subject=self._service_account_email)
def credentials_fixture(self, signer): self.credentials = jwt.Credentials( signer, self.SERVICE_ACCOUNT_EMAIL, self.SERVICE_ACCOUNT_EMAIL, self.AUDIENCE, )