Skip to content

create_token_with_iam

create_token_with_iam(
    client_id: ClientId,
    grant_type: GrantType,
    *,
    config_overrides: Optional[SSOOIDCClientConfig] = None,
    code: Optional[AuthCode] = None,
    refresh_token: Optional[RefreshToken] = None,
    assertion: Optional[Assertion] = None,
    scope: Optional[Scopes] = None,
    redirect_uri: Optional[URI] = None,
    subject_token: Optional[SubjectToken] = None,
    subject_token_type: Optional[TokenTypeURI] = None,
    requested_token_type: Optional[TokenTypeURI] = None,
    code_verifier: Optional[CodeVerifier] = None,
) -> CreateTokenWithIAMResponse

Creates and returns access and refresh tokens for authorized client applications that are authenticated using any IAM entity, such as a service role or user. These tokens might contain defined scopes that specify permissions such as read:profile or write:data. Through downscoping, you can use the scopes parameter to request tokens with reduced permissions compared to the original client application's permissions or, if applicable, the refresh token's scopes. The access token can be used to fetch short-lived credentials for the assigned Amazon Web Services accounts or to access application APIs using bearer authentication.

This API is used with Signature Version 4. For more information, see Amazon Web Services Signature Version 4 for API Requests.

Parameters:

  • client_id (ClientId) –

    The unique identifier string for the client or application. This value is an application ARN that has OAuth grants configured.

  • grant_type (GrantType) –

    Supports the following OAuth grant types: Authorization Code, Refresh Token, JWT Bearer, and Token Exchange. Specify one of the following values, depending on the grant type that you want:

    * Authorization Code - authorization_code

    * Refresh Token - refresh_token

    * JWT Bearer - urn:ietf:params:oauth:grant-type:jwt-bearer

    * Token Exchange - urn:ietf:params:oauth:grant-type:token-exchange

  • code (Optional[AuthCode], default: None ) –

    Used only when calling this API for the Authorization Code grant type. This short-lived code is used to identify this authorization request. The code is obtained through a redirect from IAM Identity Center to a redirect URI persisted in the Authorization Code GrantOptions for the application.

  • refresh_token (Optional[RefreshToken], default: None ) –

    Used only when calling this API for the Refresh Token grant type. This token is used to refresh short-lived tokens, such as the access token, that might expire.

    For more information about the features and limitations of the current IAM Identity Center OIDC implementation, see Considerations for Using this Guide in the IAM Identity Center OIDC API Reference.

  • assertion (Optional[Assertion], default: None ) –

    Used only when calling this API for the JWT Bearer grant type. This value specifies the JSON Web Token (JWT) issued by a trusted token issuer. To authorize a trusted token issuer, configure the JWT Bearer GrantOptions for the application.

  • scope (Optional[Scopes], default: None ) –

    The list of scopes for which authorization is requested. The access token that is issued is limited to the scopes that are granted. If the value is not specified, IAM Identity Center authorizes all scopes configured for the application, including the following default scopes: openid, aws, sts:identity_context.

  • redirect_uri (Optional[URI], default: None ) –

    Used only when calling this API for the Authorization Code grant type. This value specifies the location of the client or application that has registered to receive the authorization code.

  • subject_token (Optional[SubjectToken], default: None ) –

    Used only when calling this API for the Token Exchange grant type. This value specifies the subject of the exchange. The value of the subject token must be an access token issued by IAM Identity Center to a different client or application. The access token must have authorized scopes that indicate the requested application as a target audience.

  • subject_token_type (Optional[TokenTypeURI], default: None ) –

    Used only when calling this API for the Token Exchange grant type. This value specifies the type of token that is passed as the subject of the exchange. The following value is supported:

    * Access Token - urn:ietf:params:oauth:token-type:access_token

  • requested_token_type (Optional[TokenTypeURI], default: None ) –

    Used only when calling this API for the Token Exchange grant type. This value specifies the type of token that the requester can receive. The following values are supported:

    * Access Token - urn:ietf:params:oauth:token-type:access_token

    * Refresh Token - urn:ietf:params:oauth:token-type:refresh_token

  • code_verifier (Optional[CodeVerifier], default: None ) –

    Used only when calling this API for the Authorization Code grant type. This value is generated by the client and presented to validate the original code challenge value the client passed at authorization time.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • AuthorizationPendingException –

    Indicates that a request to authorize a client with an access user session token is pending.

  • ExpiredTokenException –

    Indicates that the token issued by the service is expired and is no longer valid.

  • InternalServerException –

    Indicates that an error from the service occurred while trying to process a request.

  • InvalidClientException –

    Indicates that the clientId or clientSecret in the request is invalid. For example, this can occur when a client sends an incorrect clientId or an expired clientSecret.

  • InvalidGrantException –

    Indicates that a request contains an invalid grant. This can occur if a client makes a CreateToken request with an invalid grant type.

  • InvalidRequestException –

    Indicates that something is wrong with the input to the request. For example, a required parameter might be missing or out of range.

  • InvalidRequestRegionException –

    Indicates that a token provided as input to the request was issued by and is only usable by calling IAM Identity Center endpoints in another region.

  • InvalidScopeException –

    Indicates that the scope provided in the request is invalid.

  • SlowDownException –

    Indicates that the client is making the request too frequently and is more than the service can handle.

  • UnauthorizedClientException –

    Indicates that the client is not currently authorized to make the request. This can happen when a clientId is not issued for a public client.

  • UnsupportedGrantTypeException –

    Indicates that the grant type in the request is not supported by the service.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Call OAuth/OIDC /token endpoint for Authorization Code grant with IAM authentication

>>> client.create_token_with_iam(client_id='arn:aws:sso::123456789012:application/ssoins-111111111111/apl-222222222222', grant_type='authorization_code', code='yJraWQiOiJrZXktMTU2Njk2ODA4OCIsImFsZyI6IkhTMzg0In0EXAMPLEAUTHCODE', redirect_uri='https://mywebapp.example/redirect', scope=['openid', 'aws', 'sts:identity_context'])
Call OAuth/OIDC /token endpoint for JWT Bearer grant with IAM authentication
>>> client.create_token_with_iam(client_id='arn:aws:sso::123456789012:application/ssoins-111111111111/apl-222222222222', grant_type='urn:ietf:params:oauth:grant-type:jwt-bearer', assertion='eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjFMVE16YWtpaGlSbGFfOHoyQkVKVlhlV01xbyJ9.eyJ2ZXIiOiIyLjAiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vOTEyMjA0MGQtNmM2Ny00YzViLWIxMTItMzZhMzA0YjY2ZGFkL3YyLjAiLCJzdWIiOiJBQUFBQUFBQUFBQUFBQUFBQUFBQUFJa3pxRlZyU2FTYUZIeTc4MmJidGFRIiwiYXVkIjoiNmNiMDQwMTgtYTNmNS00NmE3LWI5OTUtOTQwYzc4ZjVhZWYzIiwiZXhwIjoxNTM2MzYxNDExLCJpYXQiOjE1MzYyNzQ3MTEsIm5iZiI6MTUzNjI3NDcxMSwibmFtZSI6IkFiZSBMaW5jb2xuIiwicHJlZmVycmVkX3VzZXJuYW1lIjoiQWJlTGlAbWljcm9zb2Z0LmNvbSIsIm9pZCI6IjAwMDAwMDAwLTAwMDAtMDAwMC02NmYzLTMzMzJlY2E3ZWE4MSIsInRpZCI6IjkxMjIwNDBkLTZjNjctNGM1Yi1iMTEyLTM2YTMwNGI2NmRhZCIsIm5vbmNlIjoiMTIzNTIzIiwiYWlvIjoiRGYyVVZYTDFpeCFsTUNXTVNPSkJjRmF0emNHZnZGR2hqS3Y4cTVnMHg3MzJkUjVNQjVCaXN2R1FPN1lXQnlqZDhpUURMcSFlR2JJRGFreXA1bW5PcmNkcUhlWVNubHRlcFFtUnA2QUlaOGpZIn0.1AFWW-Ck5nROwSlltm7GzZvDwUkqvhSQpm55TQsmVo9Y59cLhRXpvB8n-55HCr9Z6G_31_UbeUkoz612I2j_Sm9FFShSDDjoaLQr54CreGIJvjtmS3EkK9a7SJBbcpL1MpUtlfygow39tFjY7EVNW9plWUvRrTgVk7lYLprvfzw-CIqw3gHC-T7IK_m_xkr08INERBtaecwhTeN4chPC4W3jdmw_lIxzC48YoQ0dB1L9-ImX98Egypfrlbm0IBL5spFzL6JDZIRRJOu8vecJvj1mq-IUhGt0MacxX8jdxYLP-KUu2d9MbNKpCKJuZ7p8gwTL5B7NlUdh_dmSviPWrw')
Call OAuth/OIDC /token endpoint for Refresh Token grant with IAM authentication
>>> client.create_token_with_iam(client_id='arn:aws:sso::123456789012:application/ssoins-111111111111/apl-222222222222', grant_type='refresh_token', refresh_token='aorvJYubGpU6i91YnH7Mfo-AT2fIVa1zCfA_Rvq9yjVKIP3onFmmykuQ7E93y2I-9Nyj-A_sVvMufaLNL0bqnDRtgAkc0:MGUCMFrRsktMRVlWaOR70XGMFGLL0SlcCw4DiYveIiOVx1uK9BbD0gvAddsW3UTLozXKMgIxAJ3qxUvjpnlLIOaaKOoa/FuNgqJVvr9GMwDtnAtlh9iZzAkEXAMPLEREFRESHTOKEN')
Call OAuth/OIDC /token endpoint for Token Exchange grant with IAM authentication
>>> client.create_token_with_iam(client_id='arn:aws:sso::123456789012:application/ssoins-111111111111/apl-222222222222', grant_type='urn:ietf:params:oauth:grant-type:token-exchange', subject_token='aoak-Hig8TUDPNX1xZwOMXM5MxOWDL0E0jg9P6_C_jKQPxS_SKCP6f0kh1Up4g7TtvQqkMnD-GJiU_S1gvug6SrggAkc0:MGYCMQD3IatVjV7jAJU91kK3PkS/SfA2wtgWzOgZWDOR7sDGN9t0phCZz5It/aes/3C1Zj0CMQCKWOgRaiz6AIhza3DSXQNMLjRKXC8F8ceCsHlgYLMZ7hZDIFFERENTACCESSTOKEN', subject_token_type='urn:ietf:params:oauth:token-type:access_token', requested_token_type='urn:ietf:params:oauth:token-type:access_token')
Source code in docs_src/capo_sso_oidc/_services/ssooidc.py
def create_token_with_iam(
    self,
    client_id: "capo_sso_oidc.types.client_id.ClientId",
    grant_type: "capo_sso_oidc.types.grant_type.GrantType",
    *,
    config_overrides: Optional[SSOOIDCClientConfig] = None,
    code: Optional["capo_sso_oidc.types.auth_code.AuthCode"] = None,
    refresh_token: Optional[
        "capo_sso_oidc.types.refresh_token.RefreshToken"
    ] = None,
    assertion: Optional["capo_sso_oidc.types.assertion.Assertion"] = None,
    scope: Optional["capo_sso_oidc.types.scopes.Scopes"] = None,
    redirect_uri: Optional["capo_sso_oidc.types.uri.URI"] = None,
    subject_token: Optional[
        "capo_sso_oidc.types.subject_token.SubjectToken"
    ] = None,
    subject_token_type: Optional[
        "capo_sso_oidc.types.token_type_uri.TokenTypeURI"
    ] = None,
    requested_token_type: Optional[
        "capo_sso_oidc.types.token_type_uri.TokenTypeURI"
    ] = None,
    code_verifier: Optional[
        "capo_sso_oidc.types.code_verifier.CodeVerifier"
    ] = None,
) -> (
    "capo_sso_oidc.types.create_token_with_iam_response.CreateTokenWithIAMResponse"
):
    """<p>Creates and returns access and refresh tokens for authorized client applications that are authenticated using any IAM entity, such as a service role or user. These tokens might contain defined scopes that specify permissions such as <code>read:profile</code> or <code>write:data</code>. Through downscoping, you can use the scopes parameter to request tokens with reduced permissions compared to the original client application's permissions or, if applicable, the refresh token's scopes. The access token can be used to fetch short-lived credentials for the assigned Amazon Web Services accounts or to access application APIs using <code>bearer</code> authentication.</p> <note> <p>This API is used with Signature Version 4. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv.html">Amazon Web Services Signature Version 4 for API Requests</a>.</p> </note>

    Args:
        client_id: <p>The unique identifier string for the client or application. This value is an application ARN that has OAuth grants configured.</p>
        grant_type: <p>Supports the following OAuth grant types: Authorization Code, Refresh Token, JWT Bearer, and Token Exchange. Specify one of the following values, depending on the grant type that you want:</p> <p>* Authorization Code - <code>authorization_code</code> </p> <p>* Refresh Token - <code>refresh_token</code> </p> <p>* JWT Bearer - <code>urn:ietf:params:oauth:grant-type:jwt-bearer</code> </p> <p>* Token Exchange - <code>urn:ietf:params:oauth:grant-type:token-exchange</code> </p>
        code: <p>Used only when calling this API for the Authorization Code grant type. This short-lived code is used to identify this authorization request. The code is obtained through a redirect from IAM Identity Center to a redirect URI persisted in the Authorization Code GrantOptions for the application.</p>
        refresh_token: <p>Used only when calling this API for the Refresh Token grant type. This token is used to refresh short-lived tokens, such as the access token, that might expire.</p> <p>For more information about the features and limitations of the current IAM Identity Center OIDC implementation, see <i>Considerations for Using this Guide</i> in the <a href="https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/Welcome.html">IAM Identity Center OIDC API Reference</a>.</p>
        assertion: <p>Used only when calling this API for the JWT Bearer grant type. This value specifies the JSON Web Token (JWT) issued by a trusted token issuer. To authorize a trusted token issuer, configure the JWT Bearer GrantOptions for the application.</p>
        scope: <p>The list of scopes for which authorization is requested. The access token that is issued is limited to the scopes that are granted. If the value is not specified, IAM Identity Center authorizes all scopes configured for the application, including the following default scopes: <code>openid</code>, <code>aws</code>, <code>sts:identity_context</code>.</p>
        redirect_uri: <p>Used only when calling this API for the Authorization Code grant type. This value specifies the location of the client or application that has registered to receive the authorization code. </p>
        subject_token: <p>Used only when calling this API for the Token Exchange grant type. This value specifies the subject of the exchange. The value of the subject token must be an access token issued by IAM Identity Center to a different client or application. The access token must have authorized scopes that indicate the requested application as a target audience.</p>
        subject_token_type: <p>Used only when calling this API for the Token Exchange grant type. This value specifies the type of token that is passed as the subject of the exchange. The following value is supported:</p> <p>* Access Token - <code>urn:ietf:params:oauth:token-type:access_token</code> </p>
        requested_token_type: <p>Used only when calling this API for the Token Exchange grant type. This value specifies the type of token that the requester can receive. The following values are supported:</p> <p>* Access Token - <code>urn:ietf:params:oauth:token-type:access_token</code> </p> <p>* Refresh Token - <code>urn:ietf:params:oauth:token-type:refresh_token</code> </p>
        code_verifier: <p>Used only when calling this API for the Authorization Code grant type. This value is generated by the client and presented to validate the original code challenge value the client passed at authorization time.</p>

    Raises:
        capo_sso_oidc.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_sso_oidc.errors.authorization_pending_exception.AuthorizationPendingException: <p>Indicates that a request to authorize a client with an access user session token is pending.</p>
        capo_sso_oidc.errors.expired_token_exception.ExpiredTokenException: <p>Indicates that the token issued by the service is expired and is no longer valid.</p>
        capo_sso_oidc.errors.internal_server_exception.InternalServerException: <p>Indicates that an error from the service occurred while trying to process a request.</p>
        capo_sso_oidc.errors.invalid_client_exception.InvalidClientException: <p>Indicates that the <code>clientId</code> or <code>clientSecret</code> in the request is invalid. For example, this can occur when a client sends an incorrect <code>clientId</code> or an expired <code>clientSecret</code>.</p>
        capo_sso_oidc.errors.invalid_grant_exception.InvalidGrantException: <p>Indicates that a request contains an invalid grant. This can occur if a client makes a <a>CreateToken</a> request with an invalid grant type.</p>
        capo_sso_oidc.errors.invalid_request_exception.InvalidRequestException: <p>Indicates that something is wrong with the input to the request. For example, a required parameter might be missing or out of range.</p>
        capo_sso_oidc.errors.invalid_request_region_exception.InvalidRequestRegionException: <p>Indicates that a token provided as input to the request was issued by and is only usable by calling IAM Identity Center endpoints in another region.</p>
        capo_sso_oidc.errors.invalid_scope_exception.InvalidScopeException: <p>Indicates that the scope provided in the request is invalid.</p>
        capo_sso_oidc.errors.slow_down_exception.SlowDownException: <p>Indicates that the client is making the request too frequently and is more than the service can handle. </p>
        capo_sso_oidc.errors.unauthorized_client_exception.UnauthorizedClientException: <p>Indicates that the client is not currently authorized to make the request. This can happen when a <code>clientId</code> is not issued for a public client.</p>
        capo_sso_oidc.errors.unsupported_grant_type_exception.UnsupportedGrantTypeException: <p>Indicates that the grant type in the request is not supported by the service.</p>
        capo_sso_oidc.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Call OAuth/OIDC /token endpoint for Authorization Code grant with IAM authentication

        >>> client.create_token_with_iam(client_id='arn:aws:sso::123456789012:application/ssoins-111111111111/apl-222222222222', grant_type='authorization_code', code='yJraWQiOiJrZXktMTU2Njk2ODA4OCIsImFsZyI6IkhTMzg0In0EXAMPLEAUTHCODE', redirect_uri='https://mywebapp.example/redirect', scope=['openid', 'aws', 'sts:identity_context'])
        Call OAuth/OIDC /token endpoint for JWT Bearer grant with IAM authentication

        >>> client.create_token_with_iam(client_id='arn:aws:sso::123456789012:application/ssoins-111111111111/apl-222222222222', grant_type='urn:ietf:params:oauth:grant-type:jwt-bearer', assertion='eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjFMVE16YWtpaGlSbGFfOHoyQkVKVlhlV01xbyJ9.eyJ2ZXIiOiIyLjAiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vOTEyMjA0MGQtNmM2Ny00YzViLWIxMTItMzZhMzA0YjY2ZGFkL3YyLjAiLCJzdWIiOiJBQUFBQUFBQUFBQUFBQUFBQUFBQUFJa3pxRlZyU2FTYUZIeTc4MmJidGFRIiwiYXVkIjoiNmNiMDQwMTgtYTNmNS00NmE3LWI5OTUtOTQwYzc4ZjVhZWYzIiwiZXhwIjoxNTM2MzYxNDExLCJpYXQiOjE1MzYyNzQ3MTEsIm5iZiI6MTUzNjI3NDcxMSwibmFtZSI6IkFiZSBMaW5jb2xuIiwicHJlZmVycmVkX3VzZXJuYW1lIjoiQWJlTGlAbWljcm9zb2Z0LmNvbSIsIm9pZCI6IjAwMDAwMDAwLTAwMDAtMDAwMC02NmYzLTMzMzJlY2E3ZWE4MSIsInRpZCI6IjkxMjIwNDBkLTZjNjctNGM1Yi1iMTEyLTM2YTMwNGI2NmRhZCIsIm5vbmNlIjoiMTIzNTIzIiwiYWlvIjoiRGYyVVZYTDFpeCFsTUNXTVNPSkJjRmF0emNHZnZGR2hqS3Y4cTVnMHg3MzJkUjVNQjVCaXN2R1FPN1lXQnlqZDhpUURMcSFlR2JJRGFreXA1bW5PcmNkcUhlWVNubHRlcFFtUnA2QUlaOGpZIn0.1AFWW-Ck5nROwSlltm7GzZvDwUkqvhSQpm55TQsmVo9Y59cLhRXpvB8n-55HCr9Z6G_31_UbeUkoz612I2j_Sm9FFShSDDjoaLQr54CreGIJvjtmS3EkK9a7SJBbcpL1MpUtlfygow39tFjY7EVNW9plWUvRrTgVk7lYLprvfzw-CIqw3gHC-T7IK_m_xkr08INERBtaecwhTeN4chPC4W3jdmw_lIxzC48YoQ0dB1L9-ImX98Egypfrlbm0IBL5spFzL6JDZIRRJOu8vecJvj1mq-IUhGt0MacxX8jdxYLP-KUu2d9MbNKpCKJuZ7p8gwTL5B7NlUdh_dmSviPWrw')
        Call OAuth/OIDC /token endpoint for Refresh Token grant with IAM authentication

        >>> client.create_token_with_iam(client_id='arn:aws:sso::123456789012:application/ssoins-111111111111/apl-222222222222', grant_type='refresh_token', refresh_token='aorvJYubGpU6i91YnH7Mfo-AT2fIVa1zCfA_Rvq9yjVKIP3onFmmykuQ7E93y2I-9Nyj-A_sVvMufaLNL0bqnDRtgAkc0:MGUCMFrRsktMRVlWaOR70XGMFGLL0SlcCw4DiYveIiOVx1uK9BbD0gvAddsW3UTLozXKMgIxAJ3qxUvjpnlLIOaaKOoa/FuNgqJVvr9GMwDtnAtlh9iZzAkEXAMPLEREFRESHTOKEN')
        Call OAuth/OIDC /token endpoint for Token Exchange grant with IAM authentication

        >>> client.create_token_with_iam(client_id='arn:aws:sso::123456789012:application/ssoins-111111111111/apl-222222222222', grant_type='urn:ietf:params:oauth:grant-type:token-exchange', subject_token='aoak-Hig8TUDPNX1xZwOMXM5MxOWDL0E0jg9P6_C_jKQPxS_SKCP6f0kh1Up4g7TtvQqkMnD-GJiU_S1gvug6SrggAkc0:MGYCMQD3IatVjV7jAJU91kK3PkS/SfA2wtgWzOgZWDOR7sDGN9t0phCZz5It/aes/3C1Zj0CMQCKWOgRaiz6AIhza3DSXQNMLjRKXC8F8ceCsHlgYLMZ7hZDIFFERENTACCESSTOKEN', subject_token_type='urn:ietf:params:oauth:token-type:access_token', requested_token_type='urn:ietf:params:oauth:token-type:access_token')
    """

    def _handler(
        req: "OperationRequest[capo_sso_oidc.types.create_token_with_iam_request.CreateTokenWithIAMRequest]",
    ) -> OperationResponse[
        "capo_sso_oidc.types.create_token_with_iam_response.CreateTokenWithIAMResponse"
    ]:
        import capo_sso_oidc._operations.awsssooidc_service.create_token_with_iam

        output, http_response = (
            capo_sso_oidc._operations.awsssooidc_service.create_token_with_iam.create_token_with_iam(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_sso_oidc.types.create_token_with_iam_request.CreateTokenWithIAMRequest",
    ) -> dict[str, Any]:
        import capo_sso_oidc.types.create_token_with_iam_request

        return capo_sso_oidc.types.create_token_with_iam_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_sso_oidc.types.create_token_with_iam_response.CreateTokenWithIAMResponse",
    ) -> dict[str, Any]:
        import capo_sso_oidc.types.create_token_with_iam_response

        return capo_sso_oidc.types.create_token_with_iam_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateTokenWithIAM",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_sso_oidc.types.create_token_with_iam_request.CreateTokenWithIAMRequest = {
        "client_id": client_id,
        "grant_type": grant_type,
    }
    if code is not None:
        input_["code"] = code
    if refresh_token is not None:
        input_["refresh_token"] = refresh_token
    if assertion is not None:
        input_["assertion"] = assertion
    if scope is not None:
        input_["scope"] = scope
    if redirect_uri is not None:
        input_["redirect_uri"] = redirect_uri
    if subject_token is not None:
        input_["subject_token"] = subject_token
    if subject_token_type is not None:
        input_["subject_token_type"] = subject_token_type
    if requested_token_type is not None:
        input_["requested_token_type"] = requested_token_type
    if code_verifier is not None:
        input_["code_verifier"] = code_verifier

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output