getActiveSession

getActiveSession()

Returns the active session object, or false if there isn’t one.

Return type:

DistributiveSession|false

Custom properties added to the returned session object are persisted across page loads automatically, provided the session is saved (which happens automatically around login/logout).

Example

const identity = require('dcp/identity');

const session = identity.getActiveSession();
if (session) console.log('Session id:', session.id);