Create a session

async AsyncCogniteClient.iam.sessions.create(
client_credentials: ClientCredentials | None = None,
session_type: Literal['CLIENT_CREDENTIALS', 'TOKEN_EXCHANGE', 'ONESHOT_TOKEN_EXCHANGE', 'DEFAULT'] = 'DEFAULT',
) CreatedSession

Create a session.

Parameters:
  • client_credentials (ClientCredentials | None) – The client credentials to create the session. This is required if session_type is set to ‘CLIENT_CREDENTIALS’.

  • session_type (SessionType | Literal['DEFAULT']) – The type of session to create. Can be either ‘CLIENT_CREDENTIALS’, ‘TOKEN_EXCHANGE’, ‘ONESHOT_TOKEN_EXCHANGE’ or ‘DEFAULT’. Defaults to ‘DEFAULT’ which will use -this- AsyncCogniteClient object to create the session. If this client was created using a token, ‘TOKEN_EXCHANGE’ will be used, and if this client was created using client credentials, ‘CLIENT_CREDENTIALS’ will be used.

Session Types:

  • client_credentials: Credentials for a session using client credentials from an identity provider.

  • token_exchange: Credentials for a session using token exchange to reuse the user’s credentials.

  • one_shot_token_exchange: Credentials for a session using one-shot token exchange to reuse the user’s credentials. One-shot sessions are short-lived sessions that are not refreshed and do not require support for token exchange from the identity provider.

Returns:

The object with token inspection details.

Return type:

CreatedSession