# Security Token Service API . v1

## Instance Methods

Close httplib2 connections.

Exchanges a credential for a Google OAuth 2.0 access token.

### Method Details

`close()`

    Close httplib2 connections.

`token(body=None, x__xgafv=None)`

    Exchanges a credential for a Google OAuth 2.0 access token.

    Args:
      body: object, The request body.
        The object takes the form of:

    { # Request message for ExchangeToken.
        "requestedTokenType": "A String", # Required. An identifier for the type of requested security token. Must be `urn:ietf:params:oauth:token-type:access_token`.
        "subjectTokenType": "A String", # Required. An identifier that indicates the type of the security token in the `subject_token` parameter. Must be `urn:ietf:params:oauth:token-type:access_token`.
        "grantType": "A String", # Required. The grant type. Must be `urn:ietf:params:oauth:grant-type:token-exchange`, which indicates a token exchange is requested.
        "options": "A String", # A set of features that Security Token Service supports, in addition to the standard OAuth 2.0 token exchange, formatted as a serialized JSON object of Options.
        "subjectToken": "A String", # Required. Input subject token. You can use a Google-issued OAuth 2.0 access token with this field to obtain an access token with new security attributes applied, such as an AccessBoundary. Applying additional security attributes on access tokens that already contain security attributes is not allowed.
      }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # Response message for ExchangeToken.
        "token_type": "A String", # The type of `access_token`. Always has the value `Bearer`.
        "issued_token_type": "A String", # The token type. Always matches the value of `requested_token_type` from the request.
        "access_token": "A String", # An OAuth 2.0 security token, issued by Google, in response to the token exchange request.
        "expires_in": 42, # The expiration time of `access_token` in seconds, measured from the time of issuance. This field is absent when the `subject_token` in the request is a Google-issued, short-lived access token. In this case, the expiration time of the `access_token` is the same as the `subject_token`.
      }