# 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.
        "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`.
        "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. The input 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 a Credential Access Boundary. If an access token already contains security attributes, you cannot apply additional security attributes.
        "grantType": "A String", # Required. The grant type. Must be `urn:ietf:params:oauth:grant-type:token-exchange`, which indicates a token exchange.
        "requestedTokenType": "A String", # Required. An identifier for the type of requested security token. Must be `urn:ietf:params:oauth:token-type:access_token`.
      }

      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.
        "issued_token_type": "A String", # The token type. Always matches the value of `requested_token_type` from the request.
        "expires_in": 42, # The amount of time, in seconds, between the time when the `access_token` was issued and the time when the `access_token` will expire. This field is absent when the `subject_token` in the request is a Google-issued, short-lived access token. In this case, the `access_token` has the same expiration time as the `subject_token`.
        "token_type": "A String", # The type of `access_token`. Always has the value `Bearer`.
        "access_token": "A String", # An OAuth 2.0 security token, issued by Google, in response to the token exchange request.
      }