AfterSessionCreatedFunction
AfterSessionCreatedFunction = (
params) =>Promise<void>
Called right after auth cookie with new session was issued, no matter which login method issued it
(password login, OAuth, passkey, two-factor confirmation or any plugin which calls auth.setAuthCookie).
Useful to persist sessions to revoke them later, or to log logins.
Thrown error is not caught, so it aborts response of the login request.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { adminforth: IAdminForth; expiresInSeconds: number; extra?: HttpExtra; pk: string | null; sessionId: string; username: string; } | - |
params.adminforth | IAdminForth | Adminforth instance. |
params.expiresInSeconds | number | How long the session (auth token) will live, in seconds. |
params.extra? | HttpExtra | Extra HTTP information of request which issued the session, e.g. to get client IP or user agent. Not passed when session is issued outside of request handling. |
params.pk | string | null | Primary key of user the session was issued for. |
params.sessionId | string | Unique id of created session. Same value is put into auth JWT and is available as AdminUser.sessionId on every request done with this session. |
params.username | string | Username of user the session was issued for. |
Returns
Promise<void>