function getSessionState
getSessionState(userId: string):
{ role: Role; tokensValidAfter: string | null; }
| undefined

Returns the user's live role and their last password change, before which their tokens don't count, or undefined when the user is gone, or comes from another instance while an admin blocks it or the deployment turns sign-ins from other instances off (FEDERATION.incoming). lib/auth.ts checks every session and media token against it.

Parameters

userId: string

Return Type

{ role: Role; tokensValidAfter: string | null; }
| undefined

Usage

import { getSessionState } from "api/services/user-service.ts";