SessionWithActivities

A wrapper over the client-side user session, with additional user activity information.

Overview

The SessionWithActivities object is a modified Session object. It contains most of the information that the Session object stores, adding extra information about the current session's latest activity.

The additional data included in the latest activity are useful for analytics purposes. A SessionActivity object will provide information about the user's location, device and browser.

While the SessionWithActivities object wraps the most important information around a Session object, the two objects have entirely different methods.

Attributes

Name

Description

id

string

A unique identifier for the session.

status

SessionStatus

The current state of the session.

lastActiveAt

Date

The time the session was last active on the Client.

abandonAt

Date

The time when the session was abandoned by the user.

expireAt

Date

The time the session expires and will seize to be active.

latestActivity

SessionActivity

An object that provides additional information about this session, focused around user activity data.

Methods

revoke()

revoke() => Promise<SessionWithActivitiesResource>

Marks this session as revoked. If this is the active session, the attempt to revoke it will fail.

Users can revoke only their own sessions.

Parameters
Returns
Parameters

This method accepts no parameters.

Returns

Promise<SessionWithActivitiesResource>

This method returns a Promise which resolves with a SessionWithActivities object.

Interfaces

SessionActivity

Property

Description

id

string

A unique identifier for the session activity record.

browserName?

string

The name of the browser from which this session activity occurred.

browserVersion?

string

The version of the browser from which this session activity occurred.

deviceType?

string

The type of the device which was used in this session activity.

ipAddress?

string

The IP address from which this session activity originated.

city?

string

The city from which this session activity occurred. Resolved by IP address geo-location.

country?

string

The country from which this session activity occurred. Resolved by IP address geo-location.

isMobile?

boolean

Will be set to true if the session activity came from a mobile device, false otherwise.

Types

SessionStatus

abandoned | active | ended | expired | removed | replaced | revoked

Value

Description

abandoned

The session was abandoned client-side.

active

The session is valid and all activity is allowed.

ended

The user signed out of the session, but the Session remains in the Client object.

expired

The period of allowed activity for this session has passed.

removed

The user signed out of the session and the Session was removed from the Client object.

replaced

The session has been replaced by another one, but the Session remains in the Client object.

revoked

The application ended the session and the Session was removed from the Client object.