Types
TypeScript types exported from @getauthui/core.
import type {
AuthUIConfig,
AuthUIState,
AuthUIView,
AuthUIStatus,
AuthUIStrings,
OAuthProviderName,
} from "@getauthui/core";AuthUIConfig
See Configuration.
AuthUIState
interface AuthUIState {
status: "loading" | "signed-out" | "signed-in" | "mfa-required";
user: Models.User<Models.Preferences> | null;
mfaFactors: Models.MfaFactors | null;
pending: AuthUIPendingAction | null;
configured: boolean;
configError: string | null;
}AuthUIPendingAction
type AuthUIPendingAction =
| { type: "reset-password"; userId: string; secret: string }
| { type: "verify-email"; userId: string; secret: string }
| { type: "oauth-failed" }
| { type: "notice"; message: string; tone: "success" | "error" | "info" };AuthUIView
"sign-in" | "sign-up" | "forgot-password" | "reset-password" | "magic-url" | "email-otp" | "phone" | "mfa" | "account"
OAuthProviderName
Every provider slug Appwrite accepts, including google, github, apple, microsoft, discord, facebook, x, linkedin, slack, gitlab, bitbucket, twitch, spotify, notion, dropbox, figma, oidc, okta, auth0, amazon, paypal, zoom, and the rest of the list in Appwrite's OAuthProvider enum.
AuthUIStrings
All UI strings. The defaults are exported as defaultStrings. Values may contain {placeholders}:
| Key | Placeholders |
|---|---|
signInTitle, signUpTitle | {name} |
continueWith | {provider} |
magicLinkSent, resetLinkSent | {email} |
codeSent | {target} |
Helpers
import {
describeError,
toAuthUIError,
ErrorTypes,
providerLabel,
defaultStrings,
FOUC_CSS,
CRITICAL_FOUC_CSS,
scorePassword,
isConfigError,
PHONE_COUNTRIES,
defaultPhoneCountryIso,
digitsOnly,
flagEmoji,
getPhoneCountry,
parsePhone,
toE164,
type ParsedPhone,
type PhoneCountry,
getLastMethod,
rememberLastMethod,
clearLastMethod,
getStoredActiveTeamId,
setStoredActiveTeamId,
getLocalePack,
localePacks,
resolveLocale,
supportedLocales,
mergeStrings,
loadGoogleIdentityServices,
promptGoogleOneTap,
resetOneTapPromptState,
} from "@getauthui/core";describeError(err, strings, context?)maps an Appwrite error to a friendly string. Pass"code"ascontextwhen the user typed a one-time code.toAuthUIError(err)normalises anything thrown into{ message, type, code }.ErrorTypeslists the Appwrite errortypestrings the UI reacts to.isConfigError(err)returns whether an error points to a wrong project, origin or endpoint, or a dead network on first contact.providerLabel(slug)returns the display name of an OAuth provider.FOUC_CSS/CRITICAL_FOUC_CSSare the critical CSS strings the in-module FOUC guard uses. Prefer the shipped stylesheet@getauthui/core/fouc.css(CDN:dist/fouc.css) in<head>before the Auth UI script (see<authui-show>).scorePassword(password)returns{ level, percent, labelKey, checks }for the live strength meter (client-only).PHONE_COUNTRIESis the country list used by the phone picker.defaultPhoneCountryIso(lang?)selects a country from a BCP 47 language tag,getPhoneCountry(iso)looks one up, andflagEmoji(iso)returns its flag emoji.digitsOnly(value)strips non-digits.toE164(iso, national)builds an E.164 number, andparsePhone(input, fallbackIso?)splits one into{ iso, national, e164 }(ParsedPhone), usingPhoneCountryentries for country data.getLastMethod()/rememberLastMethod(method)/clearLastMethod()read and writelocalStoragekeyauthui:last-method(what the sign-in form highlights as last used).getStoredActiveTeamId(project)/setStoredActiveTeamId(project, teamId)read and writelocalStoragekeyauthui:active-team:<projectId>. PreferAuthUI.store.getActiveTeamId()/setActiveTeam()in app code; these are the underlying helpers.supportedLocaleslists built-in packs (cs,de,fr).localePacksholds the partial string maps.resolveLocale(tag)normalises a BCP-47 tag to a pack key (ornull).getLocalePack(tag)returns the pack ornull.mergeStrings(defaults, locale, overrides)applies English defaults ← locale pack ← userstrings.loadGoogleIdentityServices()loads the GIS script once.promptGoogleOneTap(options)shows Google One Tap when configured.resetOneTapPromptState()clears the in-session prompt guard (useful in tests).