(self)
return token
Create the OAuth 2.0 assertion.

        This assertion is used during the OAuth 2.0 grant to acquire an
        access token.

        Returns:
            bytes: The authorization grant assertion.
Create the OAuth 2.0 assertion.
Create the OAuth 2 . 0 assertion .
def _make_authorization_grant_assertion(self):
        """Create the OAuth 2.0 assertion.

        This assertion is used during the OAuth 2.0 grant to acquire an
        access token.

        Returns:
            bytes: The authorization grant assertion.
        """
        now = _helpers.utcnow()
        lifetime = datetime.timedelta(seconds=_DEFAULT_TOKEN_LIFETIME_SECS)
        expiry = now + lifetime

        payload = {
            "iat": _helpers.datetime_to_secs(now),
            "exp": _helpers.datetime_to_secs(expiry),
            # The issuer must be the service account email.
            "iss": self._service_account_email,
            # The audience must be the auth token endpoint's URI
            "aud": _GOOGLE_OAUTH2_TOKEN_ENDPOINT,
            "scope": _helpers.scopes_to_string(self._scopes or ()),
        }

        payload.update(self._additional_claims)

        # The subject can be a user email for domain-wide delegation.
        if self._subject:
            payload.setdefault("sub", self._subject)

        token = jwt.encode(self._signer, payload)

        return token
def _make_authorization_grant_assertion ( self ) : now = _helpers . utcnow ( ) lifetime = datetime . timedelta ( seconds = _DEFAULT_TOKEN_LIFETIME_SECS ) expiry = now + lifetime payload = { "iat" : _helpers . datetime_to_secs ( now ) , "exp" : _helpers . datetime_to_secs ( expiry ) , # The issuer must be the service account email. "iss" : self . _service_account_email , # The audience must be the auth token endpoint's URI "aud" : _GOOGLE_OAUTH2_TOKEN_ENDPOINT , "scope" : _helpers . scopes_to_string ( self . _scopes or ( ) ) , } payload . update ( self . _additional_claims ) # The subject can be a user email for domain-wide delegation. if self . _subject : payload . setdefault ( "sub" , self . _subject ) token = jwt . encode ( self . _signer , payload ) return token