@auth0/auth0-react
    Preparing search index...

    Interface AnonymousSessionApiClient

    Browser-layer wrapper around auth0-auth-js AnonymousSessionClient.

    Adds local session storage (localStorage or memory) so callers never need to manage the session token themselves. getTokenSilently() returns a cached access token when still valid and renews it transparently when expired.

    The session token is stored once and shared across all audience/scope slots. Each slot stores only its own access token and expiry.

    Exposed on Auth0Client as auth0.anonymous.

    interface AnonymousSessionApiClient {
        createSession(
            options?: CreateAnonymousSessionOptions,
        ): Promise<AnonymousSession>;
        getClaims(): null;
        getTokenSilently(
            options?: AnonymousGetTokenSilentlyOptions,
        ): Promise<AnonymousTokenResult>;
        hasSession(): boolean;
        logout(): Promise<void>;
    }
    Index
    • Always returns null in EA — session tokens are issued as opaque JWEs and cannot be decoded client-side. Reserved for future JWT format support.

      Returns null

    • Returns a valid anonymous access token, creating or renewing the session as needed.

      If the stored access token is still fresh (more than 60 s remaining), it is returned directly without a network call. Otherwise the session token is used to re-mint the access token. If the session token has also expired, auth0-auth-js silently creates a fresh identity (any previously set metadata is lost).

      Parameters

      Returns Promise<AnonymousTokenResult>

    • Returns true if a session token exists in the local cache.

      Returns boolean

    • Ends the anonymous session and clears all locally stored tokens.

      Returns Promise<void>