Sanity App SDK
    Preparing search index...

    Interface AuthConfig

    Configuration options for creating an auth store.

    interface AuthConfig {
        apiHost?: string;
        callbackUrl?: string;
        clientFactory?: (config: ClientConfig) => SanityClient;
        initialLocationHref?: string;
        providers?:
            | AuthProvider[]
            | ((prev: AuthProvider[]) => AuthProvider[] | Promise<AuthProvider[]>);
        storageArea?: Storage;
        token?: string;
    }
    Index

    Properties

    apiHost?: string

    The API hostname for requests. Usually leave this undefined, but it can be set if using a custom domain or CNAME for the API endpoint.

    callbackUrl?: string

    A callback URL for your application. If none is provided, the auth API will redirect back to the current location (location.href). When handling callbacks, this URL's pathname is checked to ensure it matches the callback.

    clientFactory?: (config: ClientConfig) => SanityClient

    Factory function to create a SanityClient instance. Defaults to the standard Sanity client factory if not provided.

    initialLocationHref?: string

    The initial location href to use when handling auth callbacks. Defaults to the current window location if available.

    providers?:
        | AuthProvider[]
        | ((prev: AuthProvider[]) => AuthProvider[] | Promise<AuthProvider[]>)

    Custom authentication providers to use instead of or in addition to the default ones. Can be an array of providers or a function that takes the default providers and returns a modified array or a Promise resolving to one.

    storageArea?: Storage

    Storage implementation to persist authentication state. Defaults to localStorage if available.

    token?: string

    A static authentication token to use instead of handling the OAuth flow. When provided, the auth store will remain in a logged-in state with this token, ignoring any storage or callback handling.