<authui />

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}:

KeyPlaceholders
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" as context when the user typed a one-time code.
  • toAuthUIError(err) normalises anything thrown into { message, type, code }.
  • ErrorTypes lists the Appwrite error type strings 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_CSS are 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_COUNTRIES is the country list used by the phone picker. defaultPhoneCountryIso(lang?) selects a country from a BCP 47 language tag, getPhoneCountry(iso) looks one up, and flagEmoji(iso) returns its flag emoji.
  • digitsOnly(value) strips non-digits. toE164(iso, national) builds an E.164 number, and parsePhone(input, fallbackIso?) splits one into { iso, national, e164 } (ParsedPhone), using PhoneCountry entries for country data.
  • getLastMethod() / rememberLastMethod(method) / clearLastMethod() read and write localStorage key authui:last-method (what the sign-in form highlights as last used).
  • getStoredActiveTeamId(project) / setStoredActiveTeamId(project, teamId) read and write localStorage key authui:active-team:<projectId>. Prefer AuthUI.store.getActiveTeamId() / setActiveTeam() in app code; these are the underlying helpers.
  • supportedLocales lists built-in packs (cs, de, fr). localePacks holds the partial string maps. resolveLocale(tag) normalises a BCP-47 tag to a pack key (or null). getLocalePack(tag) returns the pack or null. mergeStrings(defaults, locale, overrides) applies English defaults ← locale pack ← user strings.
  • loadGoogleIdentityServices() loads the GIS script once. promptGoogleOneTap(options) shows Google One Tap when configured. resetOneTapPromptState() clears the in-session prompt guard (useful in tests).

On this page