auth-vir - v2.3.9
    Preparing search index...

    Class FrontendAuthClient<AssumedUserParams>

    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.

    Type Parameters

    • AssumedUserParams extends JsonCompatibleObject = EmptyObject
    Index

    Constructors

    Properties

    userCheckInterval: {} | undefined

    Methods

    • Use to handle a login response. Automatically stores the CSRF token.

      Parameters

      • response: Readonly<SelectFrom<Response, { headers: true; ok: true }>>

      Returns Promise<void>

      Error if the login response failed.

      Error if the login response has an invalid CSRF token.

    • Use to verify all responses received from the backend. Immediately logs the user out once an unauthorized response is detected.

      Parameters

      • response: Readonly<
            PartialWithUndefined<
                SelectFrom<Response, { headers: true; status: true }>,
            >,
        >

      Returns Promise<boolean>

      true if the auth is okay, false otherwise.