Assume the given user. Pass undefined to wipe the currently assumed user.
Whether the assumed user setting or clearing succeeded or not.
Creates a RequestInit object for the fetch API. If you have other request init options,
use mergeDeep from
@augment-vir/common to
combine them with these.
Destroys the client and performs all necessary cleanup (like clearing the user check interval).
Gets the assumed user params stored in local storage, if any.
Wraps getCurrentCsrfToken to automatically handle wiping an invalid CSRF token.
Wipes the current user auth.
Use to verify all responses received from the backend. Immediately logs the user out once an unauthorized response is detected.
true if the auth is okay, false otherwise.
An auth client for sending and validating client requests to a backend. This should only be used in a frontend environment as it accesses native browser APIs.