Skip to content

get_token async

get_token(
    app_id: __string,
    session_id: __string,
    *,
    config_overrides: Optional[AsyncAmplifyBackendClientConfig] = None,
) -> GetTokenResponse

Gets the challenge token based on the given appId and sessionId.

Parameters:

Raises:

Source code in docs_src/capo_amplifybackend/_services/async_amplify_backend.py
async def get_token(
    self,
    app_id: "capo_amplifybackend.types.__string.__string",
    session_id: "capo_amplifybackend.types.__string.__string",
    *,
    config_overrides: Optional[AsyncAmplifyBackendClientConfig] = None,
) -> "capo_amplifybackend.types.get_token_response.GetTokenResponse":
    """<p>Gets the challenge token based on the given appId and sessionId.</p>

    Args:
        app_id: <p>The app ID.</p>
        session_id: <p>The session ID.</p>

    Raises:
        capo_amplifybackend.errors.bad_request_exception.BadRequestException: <p>An error returned if a request is not formed properly.</p>
        capo_amplifybackend.errors.gateway_timeout_exception.GatewayTimeoutException: <p>An error returned if there's a temporary issue with the service.</p>
        capo_amplifybackend.errors.not_found_exception.NotFoundException: <p>An error returned when a specific resource type is not found.</p>
        capo_amplifybackend.errors.too_many_requests_exception.TooManyRequestsException: <p>An error that is returned when a limit of a specific type has been exceeded.</p>
        capo_amplifybackend.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_amplifybackend.types.get_token_request.GetTokenRequest]",
    ) -> AsyncOperationResponse[
        "capo_amplifybackend.types.get_token_response.GetTokenResponse"
    ]:
        import capo_amplifybackend._operations.amplify_backend.get_token

        (
            output,
            http_response,
        ) = await capo_amplifybackend._operations.amplify_backend.get_token.async_get_token(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetToken")
    )
    input_: capo_amplifybackend.types.get_token_request.GetTokenRequest = {
        "app_id": app_id,
        "session_id": session_id,
    }

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