CognitoIdentityProvider / Client / set_user_pool_session_configuration

set_user_pool_session_configuration

CognitoIdentityProvider.Client.set_user_pool_session_configuration(**kwargs)

Enables or disables session tracking for a user pool, and sets the pool-wide maximum number of active token sessions that each user can have. This operation performs a full replacement of the pool-level session configuration; every request parameter is required. The user pool must be in the Essentials or Plus tier. Otherwise, this operation returns a FeatureUnavailableInTierException.

See also: AWS API Documentation

Request Syntax

response = client.set_user_pool_session_configuration(
    UserPoolId='string',
    UserSessionTracking='ENABLED'|'DISABLED',
    TokenSession={
        'MaxPerUser': 123
    }
)
Parameters:
  • UserPoolId (string) –

    [REQUIRED]

    The ID of the user pool where you want to configure session tracking.

  • UserSessionTracking (string) –

    [REQUIRED]

    Specifies whether Amazon Cognito tracks sessions for users in the user pool. Set this value to ENABLED to turn on server-side session tracking, or DISABLED to turn it off. When you set this value to DISABLED while the user pool remains active, existing client-level session configurations are retained but dormant, and are reactivated when you enable tracking again.

  • TokenSession (dict) –

    [REQUIRED]

    The pool-wide token session settings to apply.

    • MaxPerUser (integer) – [REQUIRED]

      The maximum number of active token sessions that a user can have across the user pool. The minimum value is 1 and the maximum value is 100. The default is 20. When a user reaches this limit, the next successful authentication automatically evicts that user’s least recently used token session before it creates the new session. Lowering this value doesn’t evict existing sessions on its own; the user is brought back within the limit on their next sign-in.

Return type:

dict

Returns:

Response Syntax

{
    'UserPoolId': 'string',
    'UserSessionTracking': 'ENABLED'|'DISABLED',
    'TokenSession': {
        'MaxPerUser': 123
    }
}

Response Structure

  • (dict) –

    • UserPoolId (string) –

      The ID of the user pool that the session configuration was applied to.

    • UserSessionTracking (string) –

      The session tracking setting that was applied to the user pool.

    • TokenSession (dict) –

      The pool-wide token session settings that were applied.

      • MaxPerUser (integer) –

        The maximum number of active token sessions that a user can have across the user pool. The minimum value is 1 and the maximum value is 100. The default is 20. When a user reaches this limit, the next successful authentication automatically evicts that user’s least recently used token session before it creates the new session. Lowering this value doesn’t evict existing sessions on its own; the user is brought back within the limit on their next sign-in.

Exceptions