For AI agents: the documentation index is at llms.txt. Guide pages have a markdown version at the same path with .md appended, before any query string or fragment.

Swift: Get Authenticator Assurance Level

Examples

Get the AAL details of a session

let aal = try await supabase.auth.mfa.assuranceLevel()
let currentLevel = aal.currentLevel
let nextLevel = aal.nextLevel
let currentAuthenticationMethods = aal.currentAuthenticationMethods

Ask for a second factor when one is needed

do {
  let aal = try await supabase.auth.mfa.assuranceLevel()
  if aal.nextLevel != aal.currentLevel {
    // Show the MFA prompt.
  }
} catch let error as AuthError where error.kind == .sessionMissing {
  // Show the sign-in screen.
}