Skip to content

logout

logout(
    access_token: AccessTokenType, *, config_overrides: Optional[SSOClientConfig] = None
) -> None

Removes the locally stored SSO tokens from the client-side cache and sends an API call to the IAM Identity Center service to invalidate the corresponding server-side IAM Identity Center sign in session.

If a user uses IAM Identity Center to access the AWS CLI, the user’s IAM Identity Center sign in session is used to obtain an IAM session, as specified in the corresponding IAM Identity Center permission set. More specifically, IAM Identity Center assumes an IAM role in the target account on behalf of the user, and the corresponding temporary AWS credentials are returned to the client.

After user logout, any existing IAM role sessions that were created by using IAM Identity Center permission sets continue based on the duration configured in the permission set. For more information, see User authentications in the IAM Identity Center User Guide.

Parameters:

  • access_token (AccessTokenType) –

    The token issued by the CreateToken API call. For more information, see CreateToken in the IAM Identity Center OIDC API Reference Guide.

Raises:

  • InvalidRequestException –

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

  • TooManyRequestsException –

    Indicates that the request is being made too frequently and is more than what the server can handle.

  • UnauthorizedException –

    Indicates that the request is not authorized. This can happen due to an invalid access token in the request.

  • UnknownServiceError –

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

Source code in docs_src/capo_sso/_services/sso.py
def logout(
    self,
    access_token: "capo_sso.types.access_token_type.AccessTokenType",
    *,
    config_overrides: Optional[SSOClientConfig] = None,
) -> None:
    """<p>Removes the locally stored SSO tokens from the client-side cache and sends an API call to the IAM Identity Center service to invalidate the corresponding server-side IAM Identity Center sign in session.</p> <note> <p>If a user uses IAM Identity Center to access the AWS CLI, the user’s IAM Identity Center sign in session is used to obtain an IAM session, as specified in the corresponding IAM Identity Center permission set. More specifically, IAM Identity Center assumes an IAM role in the target account on behalf of the user, and the corresponding temporary AWS credentials are returned to the client.</p> <p>After user logout, any existing IAM role sessions that were created by using IAM Identity Center permission sets continue based on the duration configured in the permission set. For more information, see <a href="https://docs.aws.amazon.com/singlesignon/latest/userguide/authconcept.html">User authentications</a> in the <i>IAM Identity Center User Guide</i>.</p> </note>

    Args:
        access_token: <p>The token issued by the <code>CreateToken</code> API call. For more information, see <a href="https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html">CreateToken</a> in the <i>IAM Identity Center OIDC API Reference Guide</i>.</p>

    Raises:
        capo_sso.errors.invalid_request_exception.InvalidRequestException: <p>Indicates that a problem occurred with the input to the request. For example, a required parameter might be missing or out of range.</p>
        capo_sso.errors.too_many_requests_exception.TooManyRequestsException: <p>Indicates that the request is being made too frequently and is more than what the server can handle.</p>
        capo_sso.errors.unauthorized_exception.UnauthorizedException: <p>Indicates that the request is not authorized. This can happen due to an invalid access token in the request.</p>
        capo_sso.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sso.types.logout_request.LogoutRequest]",
    ) -> OperationResponse[None]:
        import capo_sso._operations.swb_portal_service.logout

        output, http_response = (
            capo_sso._operations.swb_portal_service.logout.logout(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_sso.types.logout_request.LogoutRequest",
    ) -> dict[str, Any]:
        import capo_sso.types.logout_request

        return capo_sso.types.logout_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("Logout", redact_input=_redact_input)
    )
    input_: capo_sso.types.logout_request.LogoutRequest = {
        "access_token": access_token
    }

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