Returns the internal EnvConfig instance for advanced inspection.
Creates a new LogoutClient instance.
Optional overrides for environment‑based configuration.
Configuration is resolved from constructor options first, then from environment
variables (.env file or Bun.env). The client expects a valid session
to have been previously saved by AuthClient.
Performs the logout using the CSRF token stored in the cached session.
Steps:
NOT_AUTHENTICATED if missing/invalid)._token and cookies.The request uses retries with exponential backoff for transient failures
(HTTP 5xx and network errors).
Performs the logout using an explicitly provided CSRF token.
The CSRF token to send in the logout request.
Same as logout.
This method is useful when the cached token may be outdated or when the
caller has a more recent token (e.g., after refreshing the CSRF token).
The session cookies are still loaded from the cache; only the token is overridden.
const freshToken = await someMethodToRefreshToken();
await logout.logoutWithToken(freshToken);
Clears the local session cache without sending a logout request.
Loads the cached session from disk without validation.
The stored session, or null if none exists.
This method does not check the loggedIn flag or session freshness.
Use AuthClient.hasValidSession for validity checks.
ReadonlyconfigValidated configuration object (base URL, paths).
ReadonlycacheDisk cache manager for reading the session.
Handles loading session data from the file system. The cache file path
can be obtained via CacheManager.cacheFilePath.
Client for logging out of a CSRF‑protected web application.
Remarks
The client loads a previously cached session (from AuthClient), extracts
the cookies and CSRF token, and sends a POST request to the logout endpoint.
If the logout request succeeds (HTTP 2xx or 3xx), the local session cache is
deleted. Any server error or invalid response throws an appropriate AuthError.
The client is configurable via environment variables (
.envfile) or constructoroptions. It supports retries with exponential backoff and optional
Referer/Originheaders.Important: A valid session must have been created by AuthClient
and cached to disk before using
LogoutClient. Use hasValidSessionfrom
AuthClientto verify.Example
Example
Example
Since
0.1.1
See