Skip to content

complete_o_auth_session_binding

complete_o_auth_session_binding(
    session_uri: SessionUri,
    *,
    config_overrides: Optional[CredentialBrokerClientConfig] = None,
) -> CompleteOAuthSessionBindingResponse

Completes a consent session. Call this from the handler at your session-binding URL, over a session carrying the same end-user identity that started the flow. On a match the broker obtains the token and holds it for later retrieval. On a mismatch it fails with AccessDeniedException and reason SESSION_BINDING_IDENTITY_MISMATCH, and no token is kept.

Parameters:

  • session_uri (SessionUri) –

    The session handle from StartOAuthSession.

Raises:

  • AccessDeniedException –

    The caller is not authorized to perform the request, or a resource the request depends on refused access. reason distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.

  • ConflictException –

    The request conflicts with the current state of the resource. Nothing was changed. Depending on reason, the request may succeed if retried once the resource reaches a settled state, or it may require different input (for example a name that is not already taken).

  • InternalServerException –

    The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.

  • ResourceNotFoundException –

    The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.

  • ServiceUnavailableException –

    A downstream dependency the broker relies on is temporarily unavailable, notably the customer's external IdP token/discovery endpoint (upstream 5xx, server_error, or temporarily_unavailable). Retryable: the same request may succeed later.

  • ThrottlingException –

    The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring retryAfterSeconds when it is present.

  • ValidationException –

    The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use reason to branch in code and message for the human-readable detail of which field or combination of fields was at fault.

  • UnknownServiceError –

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

Source code in docs_src/capo_credentialbroker/_services/credential_broker.py
def complete_o_auth_session_binding(
    self,
    session_uri: "capo_credentialbroker.types.session_uri.SessionUri",
    *,
    config_overrides: Optional[CredentialBrokerClientConfig] = None,
) -> "capo_credentialbroker.types.complete_o_auth_session_binding_response.CompleteOAuthSessionBindingResponse":
    """<p>Completes a consent session. Call this from the handler at your session-binding URL, over a session carrying the same end-user identity that started the flow. On a match the broker obtains the token and holds it for later retrieval. On a mismatch it fails with AccessDeniedException and reason SESSION_BINDING_IDENTITY_MISMATCH, and no token is kept.</p>

    Args:
        session_uri: <p>The session handle from StartOAuthSession.</p>

    Raises:
        capo_credentialbroker.errors.access_denied_exception.AccessDeniedException: <p>The caller is not authorized to perform the request, or a resource the request depends on refused access. <code>reason</code> distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.</p>
        capo_credentialbroker.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource. Nothing was changed. Depending on <code>reason</code>, the request may succeed if retried once the resource reaches a settled state, or it may require different input (for example a name that is not already taken).</p>
        capo_credentialbroker.errors.internal_server_exception.InternalServerException: <p>The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.</p>
        capo_credentialbroker.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.</p>
        capo_credentialbroker.errors.service_unavailable_exception.ServiceUnavailableException: <p>A downstream dependency the broker relies on is temporarily unavailable, notably the customer's external IdP token/discovery endpoint (upstream 5xx, <code>server_error</code>, or <code>temporarily_unavailable</code>). Retryable: the same request may succeed later.</p>
        capo_credentialbroker.errors.throttling_exception.ThrottlingException: <p>The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring <code>retryAfterSeconds</code> when it is present.</p>
        capo_credentialbroker.errors.validation_exception.ValidationException: <p>The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use <code>reason</code> to branch in code and <code>message</code> for the human-readable detail of which field or combination of fields was at fault.</p>
        capo_credentialbroker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_credentialbroker.types.complete_o_auth_session_binding_request.CompleteOAuthSessionBindingRequest]",
    ) -> OperationResponse[
        "capo_credentialbroker.types.complete_o_auth_session_binding_response.CompleteOAuthSessionBindingResponse"
    ]:
        import capo_credentialbroker._operations.aws_tessera_data_plane.complete_o_auth_session_binding

        output, http_response = (
            capo_credentialbroker._operations.aws_tessera_data_plane.complete_o_auth_session_binding.complete_o_auth_session_binding(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CompleteOAuthSessionBinding")
    )
    input_: capo_credentialbroker.types.complete_o_auth_session_binding_request.CompleteOAuthSessionBindingRequest = {
        "session_uri": session_uri
    }

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