Kotlin: Enroll a factor

Enrolls a new factor.

Parameters

Examples

Enroll a time-based, one-time password (TOTP) factor

val factor = supabase.auth.mfa.enroll(factorType = FactorType.TOTP)

// Use the id to create a challenge.
// The challenge can be verified by entering the code generated from the authenticator app.
// The code will be generated upon scanning the qr_code or entering the secret into the authenticator app.
val (id, type, qrCode) = factor.data //qrCode is a svg as a string
val (factorId, factorType, _) = factor

Check the local user for verified factors

val verifiedFactors = supabase.auth.mfa.verifiedFactors

Retrieve verified factors

val verifiedFactors = supabase.auth.mfa.retrieveFactorsForCurrentUser()