Session
The Session object is an abstraction over an HTTP session. It models the period of information exchange between a user and the server.
The Session object includes methods for recording session activity and ending the session client-side. For security reasons, sessions can also expire server-side.
As soon as a User signs in, Clerk creates a Session for the current Client. Clients can have more than one sessions at any point in time, but only one of those sessions will be active.
In certain scenarios, a session might be replaced by another one. This is often the case with multi-session applications.
All sessions that are expired, removed, replaced, ended or abandoned are not considered valid.
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.
Constructors
Properties
Convenience accessor to tell if the given session is the current device. Used mostly for constructing the User profile security view.
The time the session was last active on the client.
The last active organization identifier.
The last active token for the session.
The latest activity associated with the session.
Public information about the user that this session belongs to.
The current state of the session.
Functions
Deletes the current session.
Fetches a fresh JWT for the session.
Revokes the current session.