Skip to main content

AuthN | Python SDK | Session Endpoints

Session Endpoints

Invalidate Session

authn.session.invalidate(session_id)

Invalidate a session by session ID.

str

An ID for a session

A PangeaResponse with an empty object in the response.result field.

authn.session.invalidate(
    session_id="pmt_zppkzrjguxyblaia6itbiesejn7jejnr",
)

List session (service token)

authn.session.list(filter, last, order, order_by, size)

List sessions.

dict
str

Reflected value from a previous response to obtain the next page of results.

m.ItemOrder

Order results asc(ending) or desc(ending).

m.SessionListOrderBy

Which field to order results by.

int

Maximum results to include in the response. Minimum: 1.

A PangeaResponse with a list of sessions in the response.result field. Available response fields can be found in our API Documentation.

response = authn.session.list()

Log out (service token)

authn.session.logout(user_id)

Invalidate all sessions belonging to a user.

str

The id of a user.

A PangeaResponse with an empty object in the response.result field.

authn.session.logout(
    user_id="pui_xpkhwpnz2cmegsws737xbsqnmnuwtvm5",
)

Invalidate Session | Client

authn.client.session.invalidate(token, session_id)

Invalidate a session by session ID using a client token.

str

A user token value

str

An ID for a session

A PangeaResponse with an empty object in the response.result field.

authn.client.session.invalidate(
    token="ptu_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a",
    session_id="pmt_zppkzrjguxyblaia6itbiesejn7jejnr",
)

List sessions (client token)

authn.client.session.list(token, filter, last, order, order_by, size)

List sessions using a client token.

str

A user token value

dict
str

Reflected value from a previous response to obtain the next page of results.

m.ItemOrder

Order results asc(ending) or desc(ending).

m.SessionListOrderBy

Which field to order results by.

int

Maximum results to include in the response. Minimum: 1.

A PangeaResponse with a list of sessions in the response.result field. Available response fields can be found in our API Documentation.

response = authn.client.session.list(
    token="ptu_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a",
)

Log out (client token)

authn.client.session.logout(token)

Log out the current user's session.

str

A user token value

A PangeaResponse with an empty object in the response.result field.

authn.client.session.logout(
    token="ptu_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a",
)

Refresh a Session

authn.client.session.refresh(refresh_token, user_token)

Refresh a session token.

str

A refresh token value

str

A user token value

A PangeaResponse with credentials for a login session in the response.result field. Available response fields can be found in our API Documentation.

response = authn.client.session.refresh(
    refresh_token="ptr_xpkhwpnz2cmegsws737xbsqnmnuwtbm5",
    user_token="ptu_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a",
)