Skip to content

Documentation / expo / useMfaEnrollment

Function: useMfaEnrollment()

useMfaEnrollment(): Object

Use this hook to enroll a user in MFA

Returns

Object

initMfaEnrollment - starts the MFA enrollment flow

submitMfaEnrollment - completes the MFA enrollment flow

unenrollMfa - unenrolls the MFA method

initMfaEnrollment

initMfaEnrollment: (args) => Promise<void>(args) => Promise<Object>(args) => Promise<void>

Parameters

args: Object

args.method: "sms"

args.phoneNumber: string

Returns

Promise<void>

Parameters

args: Object

args.method: "totp"

Returns

Promise<Object>

authUrl?

authUrl?: string

secret?

secret?: string

Parameters

args: Object

args.method: "passkey"

Returns

Promise<void>

submitMfaEnrollment

submitMfaEnrollment: (args) => Promise<void>(args) => Promise<void>(args) => Promise<void>

Parameters

args: Object

args.code: string

args.method: "sms"

args.phoneNumber: string

Returns

Promise<void>

Parameters

args: Object

args.code: string

args.method: "totp"

Returns

Promise<void>

Parameters

args: Object

args.credentialIds: string[]

args.method: "passkey"

Returns

Promise<void>

unenrollMfa

unenrollMfa: (args) => Promise<void>

Parameters

args: Object

args.method: MfaMethod

Returns

Promise<void>

Example

ts
const {unenrollMfa} = useMfaEnrollment();

<button
 onClick={() => {
   unenrollMfa({mfaMethod: 'sms'});
 }}
>
Unenroll in SMS MFA
</button>

Example

ts
const {unenrollMfa} = useMfaEnrollment();

<button
 onClick={() => {
   unenrollMfa({mfaMethod: 'totp'});
 }}
>
 Unenroll in TOTP MFA
</button>