SessionWithActivities
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.
Properties
Name | Type | 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()
function revoke(): Promise<SessionWithActivities>;
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.
Types
SessionActivity
Name | Type | Description |
---|---|---|
id | string | A unique identifier for the session activity record. |
browserName | string | undefined | The name of the browser from which this session activity occurred. |
browserVersion | string | undefined | The version of the browser from which this session activity occurred. |
deviceType | string | undefined | The type of the device which was used in this session activity. |
ipAddress | string | undefined | The IP address from which this session activity originated. |
city | string | undefined | The city from which this session activity occurred. Resolved by IP address geo-location. |
country | string | undefined | The country from which this session activity occurred. Resolved by IP address geo-location. |
isMobile | boolean | undefined | Will be set to true if the session activity came from a mobile device. Set to false otherwise. |
SessionStatus
type 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. |