@public
interface
AuthConfig
Authentication options
Import
import {type AuthConfig} from 'sanity'
Signature
interface AuthConfig {
apiHost?: string
loginMethod?: LoginMethod
mode?: 'append' | 'replace'
providers?: AuthProvider[] | ((prev: AuthProvider[]) => AuthProvider[] | Promise<AuthProvider[]>)
redirectOnSingle?: boolean
}
Properties
apiHost?: string
apiHost?: string
The API hostname for requests. Should usually be left undefined, but can be set if using custom cname for API domain.
loginMethod?: LoginMethod
loginMethod?: LoginMethod
Login method to use for the studio. Can be one of: - dual
(default) - attempt to use cookies where possible, falling back to storing authentication token in localStorage
otherwise - cookie
- explicitly disable localStorage
method, relying only on cookies. May fail due to cookies being treated as third-party cookies in some browsers, thus the default is dual
. - token
- explicitly disable cookies, relying only on localStorage
method
mode?: 'append' | 'replace'
mode?: 'append' | 'replace'
Whether to append the providers specified in providers
with the default providers from the API, or replace the default providers with the ones specified.
providers?: AuthProvider[] | ((prev: AuthProvider[]) => AuthProvider[] | Promise<AuthProvider[]>)
providers?: AuthProvider[] | ((prev: AuthProvider[]) => AuthProvider[] | Promise<AuthProvider[]>)
Array of authentication providers to use, or a function that takes an array of default authentication providers (fetched from the Sanity API) and should return a new list of providers. This can be used to selectively replace, add or remove providers from the list of choices.
redirectOnSingle?: boolean
redirectOnSingle?: boolean
If true, the "Choose login provider" (eg "Google, "GitHub", "E-mail/password") screen will be skipped if only a single provider is configured in the providers
array - instead it will redirect unauthenticated users straight to the authentication URL.