# Multi-factor authentication module
This module is used for binding the MFA authenticator, unbinding the MFA authenticator, and second authentication of the user.
Request to bind MFA authenticator:
import {AuthenticationClient} from "authing-js-sdk"
const authenticationClient = new AuthenticationClient({
appId: "YOUR_APP_ID",
})
await authenticationClient.mfa.assosicateMfaAuthenticator({authenticatorType:'totp'})
Verify the MFA secondary password:
import {AuthenticationClient} from "authing-js-sdk"
const authenticationClient = new AuthenticationClient({
appId: "YOUR_APP_ID",
})
await authenticationClient.mfa.verifyTotpMfa({totp: '112233', mfaToken:'xxx'})
# Get MFA Authenticator
MfaAuthenticationClient().getMfaAuthenticators()
Obtain MFA Authenticator
# Parameters
# Example
const authenticationClient = new AuthenticationClient({
appId: "YOUR_APP_ID",
})
const authenticators = await authenticationClient.mfa.getMfaAuthenticators({ type:'totp' })
# return value
Promise<IMfaAuthenticators>
# Request MFA QR code and key information
MfaAuthenticationClient().assosicateMfaAuthenticator()
Request MFA QR code and key information
# Parameters
# Example
const authenticationClient = new AuthenticationClient({
appId: "YOUR_APP_ID",
})
const authenticators = await authenticationClient.mfa.assosicateMfaAuthenticator({ authenticatorType:'totp' })
# return value
Promise<IMfaAssociation>
# Unbind MFA
MfaAuthenticationClient().deleteMfaAuthenticator()
Unbind MFA
# Parameters
# Example
const authenticationClient = new AuthenticationClient({
appId: "YOUR_APP_ID",
})
const authenticators = await authenticationClient.mfa.deleteMfaAuthenticator()
# return value
Promise<IMfaDeleteAssociation>
# Confirm to bind MFA
MfaAuthenticationClient().confirmAssosicateMfaAuthenticator()
Confirm binding MFA
# Parameters
# Example
const authenticationClient = new AuthenticationClient({
appId: "YOUR_APP_ID",
})
const authenticators = await authenticationClient.mfa.confirmAssosicateMfaAuthenticator({ authenticatorType:'totp', totp: '112233' })
# return value
Promise<IMfaConfirmAssociation>
# Verify the MFA password for the second verification
MfaAuthenticationClient().verifyTotpMfa()
Verify the MFA password for secondary verification
# Parameters
# Example
const authenticationClient = new AuthenticationClient({
appId: "YOUR_APP_ID",
})
const authenticators = await authenticationClient.mfa.verifyTotpMfa({ authenticatorType:'totp', totp: '112233' })
# return value
Promise<User>
# Check the second verification MFA recovery code
MfaAuthenticationClient().verifyTotpRecoveryCode()
Check the second verification MFA recovery code
# Parameters
# Example
const authenticationClient = new AuthenticationClient({
appId: "YOUR_APP_ID",
})
const authenticators = await authenticationClient.mfa.verifyTotpRecoveryCode({ authenticatorType:'totp', totp: '112233' })
# return value
Promise<User>