Skip to main content

SessionManager

@loginid/websdk3Docs


@loginid/websdk3 / Internal Modules / SessionManager

Class: SessionManager

Constructors

new SessionManager()

new SessionManager(config): SessionManager

Initializes a new instance of SessionManager with the provided configuration.

Parameters

config: LoginIDConfig

Configuration object for LoginID.

Returns

SessionManager

Methods

getJwtCookie()

getJwtCookie(): undefined | string

Retrieves the JWT access token.

Returns

undefined | string

The JWT access token.


getJwtCookieName()

getJwtCookieName(): string

Returns the dynamic Cookie name holding the authorization token for the given application.

Returns

string

The name of the cookie


getSessionInfo()

getSessionInfo(): null | SessionInfo

Retrieves the currently authenticated user's session information.

Returns

null | SessionInfo

The currently authenticated user's information, including username and id. It will return null if user is not authenticated


getToken()

getToken(options): string

Retrieves the authentication token from the provided options or from cookies if not available in options.

Parameters

options: PasskeyOptions

Options containing the token.

Returns

string

The authentication token.


isLoggedIn()

isLoggedIn(): boolean

Checks if the user is logged in.

Returns

boolean


logout()

logout(): void

Deletes the jwt cookie.

Returns

void


setJwtCookie()

setJwtCookie(jwt): void

Set jwt token to local Cookie

Parameters

jwt: string

Configuration object for LoginID API, including the base URL.

Returns

void