Skip to content

complete_resource_token_auth async

complete_resource_token_auth(
    user_identifier: UserIdentifier,
    session_uri: RequestUri,
    *,
    config_overrides: Optional[AsyncBedrockAgentCoreClientConfig] = None,
) -> CompleteResourceTokenAuthResponse

Confirms the user authentication session for obtaining OAuth2.0 tokens for a resource.

Parameters:

  • user_identifier (UserIdentifier) –

    The OAuth2.0 token or user ID that was used to generate the workload access token used for initiating the user authorization flow to retrieve OAuth2.0 tokens.

  • session_uri (RequestUri) –

    Unique identifier for the user's authentication session for retrieving OAuth2 tokens. This ID tracks the authorization flow state across multiple requests and responses during the OAuth2 authentication process.

Raises:

  • AccessDeniedException –

    The exception that occurs when you do not have sufficient permissions to perform an action. Verify that your IAM policy includes the necessary permissions for the operation you are trying to perform.

  • InternalServerException –

    The exception that occurs when the service encounters an unexpected internal error. This is a temporary condition that will resolve itself with retries. We recommend implementing exponential backoff retry logic in your application.

  • ResourceNotFoundException –

    The exception that occurs when the specified resource does not exist. This can happen when using an invalid identifier or when trying to access a resource that has been deleted.

  • ThrottlingException –

    The exception that occurs when the request was denied due to request throttling. This happens when you exceed the allowed request rate for an operation. Reduce the frequency of requests or implement exponential backoff retry logic in your application.

  • UnauthorizedException –

    This exception is thrown when the JWT bearer token is invalid or not found for OAuth bearer token based access

  • ValidationException –

    The exception that occurs when the input fails to satisfy the constraints specified by the service. Check the error message for details about which input parameter is invalid and correct your request.

  • UnknownServiceError –

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

Source code in docs_src/capo_bedrock_agentcore/_services/async_bedrock_agent_core.py
async def complete_resource_token_auth(
    self,
    user_identifier: "capo_bedrock_agentcore.types.user_identifier.UserIdentifier",
    session_uri: "capo_bedrock_agentcore.types.request_uri.RequestUri",
    *,
    config_overrides: Optional[AsyncBedrockAgentCoreClientConfig] = None,
) -> "capo_bedrock_agentcore.types.complete_resource_token_auth_response.CompleteResourceTokenAuthResponse":
    """<p>Confirms the user authentication session for obtaining OAuth2.0 tokens for a resource.</p>

    Args:
        user_identifier: <p>The OAuth2.0 token or user ID that was used to generate the workload access token used for initiating the user authorization flow to retrieve OAuth2.0 tokens.</p>
        session_uri: <p>Unique identifier for the user's authentication session for retrieving OAuth2 tokens. This ID tracks the authorization flow state across multiple requests and responses during the OAuth2 authentication process.</p>

    Raises:
        capo_bedrock_agentcore.errors.access_denied_exception.AccessDeniedException: <p>The exception that occurs when you do not have sufficient permissions to perform an action. Verify that your IAM policy includes the necessary permissions for the operation you are trying to perform.</p>
        capo_bedrock_agentcore.errors.internal_server_exception.InternalServerException: <p>The exception that occurs when the service encounters an unexpected internal error. This is a temporary condition that will resolve itself with retries. We recommend implementing exponential backoff retry logic in your application.</p>
        capo_bedrock_agentcore.errors.resource_not_found_exception.ResourceNotFoundException: <p>The exception that occurs when the specified resource does not exist. This can happen when using an invalid identifier or when trying to access a resource that has been deleted.</p>
        capo_bedrock_agentcore.errors.throttling_exception.ThrottlingException: <p>The exception that occurs when the request was denied due to request throttling. This happens when you exceed the allowed request rate for an operation. Reduce the frequency of requests or implement exponential backoff retry logic in your application.</p>
        capo_bedrock_agentcore.errors.unauthorized_exception.UnauthorizedException: <p>This exception is thrown when the JWT bearer token is invalid or not found for OAuth bearer token based access</p>
        capo_bedrock_agentcore.errors.validation_exception.ValidationException: <p>The exception that occurs when the input fails to satisfy the constraints specified by the service. Check the error message for details about which input parameter is invalid and correct your request.</p>
        capo_bedrock_agentcore.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_bedrock_agentcore.types.complete_resource_token_auth_request.CompleteResourceTokenAuthRequest]",
    ) -> AsyncOperationResponse[
        "capo_bedrock_agentcore.types.complete_resource_token_auth_response.CompleteResourceTokenAuthResponse"
    ]:
        import capo_bedrock_agentcore._operations.amazon_bedrock_agent_core.complete_resource_token_auth

        (
            output,
            http_response,
        ) = await capo_bedrock_agentcore._operations.amazon_bedrock_agent_core.complete_resource_token_auth.async_complete_resource_token_auth(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_bedrock_agentcore.types.complete_resource_token_auth_request.CompleteResourceTokenAuthRequest",
    ) -> dict[str, Any]:
        import capo_bedrock_agentcore.types.complete_resource_token_auth_request

        return capo_bedrock_agentcore.types.complete_resource_token_auth_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CompleteResourceTokenAuth", redact_input=_redact_input),
    )
    input_: capo_bedrock_agentcore.types.complete_resource_token_auth_request.CompleteResourceTokenAuthRequest = {
        "user_identifier": user_identifier,
        "session_uri": session_uri,
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output