Mailmus
Auth

Sessions

Signed-in devices — list and revoke a Customer's active sessions.

Every successful sign-in (password, code, OAuth, magic link) creates a separate session, with its own refresh token. A user can be signed in on several devices at once.

List the signed-in devices

const sessions = await auth.sessions.list();
// CustomerSessionSummary[] — { id, userAgent, ipAddress, createdAt, expiresAt, current, supportSession }

current marks the session making the call — handy to tell "this device" apart from the rest in your UI ("Sign out every other device").

supportSession marks a session a member of your team opened to reproduce an issue (Sign in as a user). It ends on its own within 60 minutes, and the user can still sign it out like any other session.

Revoke a session

await auth.sessions.revoke(sessionId);

Revoking the current session is the same as signOut() — the matching refresh token becomes invalid on the server immediately, and the next refresh() fails.

Token model

No cookies: the tokens (access and refresh) travel as Bearer tokens and are stored on the client (localStorage by default, with a pluggable TokenStorage through the client's storage option). The access token is a short-lived JWT — see Verify sessions in your backend to check it server-side without calling Mailmus on every request.

Refreshing is automatic and invisible: the SDK renews the access token in the background before it expires, with nothing to do on your side.

Administration (server SDK)

To revoke a user's sessions from your backend (after a report of a compromised account, for instance), use the mailmus package with your secret key — see the API Reference for the Customers/* admin endpoints.

Next

On this page