GoTrueMFAApi
import type { GoTrueMFAApi } from "https://esm.sh/@supabase/supabase-js@2.95.3/dist/index.d.mts";Contains the full multi-factor authentication API.
§Properties
§Methods
Prepares a challenge used to verify that a user has access to a MFA factor.
Helper method which creates a challenge and immediately uses the given code to verify against it thereafter. The verification code is provided by the user by entering a code seen in their authenticator app.
Starts the enrollment process for a new Multi-Factor Authentication (MFA)
factor. This method creates a new unverified factor.
To verify a factor, present the QR code or secret to the user and ask them to add it to their
authenticator app.
The user has to enter the code from their authenticator app to verify it.
Upon verifying a factor, all other sessions are logged out and the current session's authenticator level is promoted to aal2.
Returns the Authenticator Assurance Level (AAL) for the active session.
aal1(ornull) means that the user's identity has been verified only with a conventional login (email+password, OTP, magic link, social login, etc.).aal2means that the user's identity has been verified both with a conventional login and at least one MFA factor.
When called without a JWT parameter, this method is fairly quick (microseconds) and rarely uses the network. When a JWT is provided (useful in server-side environments like Edge Functions where no session is stored), this method will make a network request to validate the user and fetch their MFA factors.
Takes in an optional access token JWT. If no JWT is provided, the JWT from the current session is used.
Returns the list of MFA factors enabled for this user.
Unenroll removes a MFA factor.
A user has to have an aal2 authenticator level in order to unenroll a verified factor.
Verifies a code against a challenge. The verification code is provided by the user by entering a code seen in their authenticator app.