Authing DocsDocuments
Concept
workflow
Guides
Development Integration
Application integration
Concept
workflow
Guides
Development Integration
Application integration
Old Version
Development Integration
  • Single Sign-On (SSO)
  • Login component

  • JavaScript/Node.js

  • Java / Kotlin

  • Python

  • C#

  • PHP

  • Go

  • Ruby
  • Android

  • iOS

    • Quick start
    • Auth Flow
    • APIs

      • Authentication
      • OIDC
      • MFA
      • User management
      • Scan to login
    • Third-party identity source

    • Typical scene

    • On-premise
    • WebAuthn
    • Error Code List
  • Flutter

  • React Native
  • WeChat Mini Program
  • WeChat webpage authorization
  • Framework Integration
  • Error code
  1. Development Integration
  2. /
  3. iOS
  4. /
  5. APIs
  6. /
  7. MFA

¶ MFA API

Update Time: 2026-03-25 09:13:34
Edit

¶ MFA check

Check if phone number or email address can be used for MFA

func mfaCheck(phone: String?, email: String?, completion: @escaping(Int, String?, Bool?) -> Void)

param

  • phone phone number to be checked. can be null
  • email email address to be checked. can be null

example

AuthClient().mfaCheck(phone: "188xxxx8888", email: nil) { code, message, ok in
    if (code == 200) {
        if (ok) {
            
        }
    }
}

AuthClient().mfaCheck(phone: nil, email: "abc@gmail.com") { code, message, ok in
    if (code == 200) {
        if (ok) {
            
        }
    }
}

¶ SMS

MFA by SMS

func mfaVerifyByPhone(phone: String, code: String, completion: @escaping(Int, String?, UserInfo?) -> Void)

param

  • phone phone number
  • code SMS verification code

example

AuthClient().mfaVerifyByPhone(phone: "188xxxx8888", code: "1234") { code, message, userInfo in
    // userInfo
}

¶ Email

MFA by email

func mfaVerifyByEmail(email: String, code: String, completion: @escaping(Int, String?, UserInfo?) -> Void)

param

  • email email address
  • code email verification code

example

AuthClient().mfaVerifyByEmail(email: "abc@gmail.com", code: "1234") { code, message, userInfo in
    // userInfo
}

¶ TOTP

MFA by TOTP (Time-based One Time Password)

func mfaVerifyByOTP(code: String, completion: @escaping(Int, String?, UserInfo?) -> Void)

param

  • code TOTP code

example

AuthClient().mfaVerifyByTOTP(code: "1234") { code, message, userInfo in
    // userInfo
}

¶ Recovery code

MFA by recovery code. When user binds TOTP, a recovery code will be generated. User should save this code securely and pass it as parameter for this API

When MFA succeed, a new recovery code will be generated, the old one becomes invalid

func mfaVerifyByRecoveryCode(code: String, completion: @escaping(Int, String?, UserInfo?) -> Void)

param

  • code recovery code

example

AuthClient().mfaVerifyByRecoveryCode(code: "1234") { code, message, userInfo in
    // userInfo
}

¶ Upload face photo

Upload a photo before face recognition, this interface returns the Key value of the photo, used for face verification.

func uploadFaceImage(_ image: UIImage,_ isPrivate: Bool = true, completion: @escaping (Int, String?) -> Void)

param

  • image photo

example

AuthClient().uploadFaceImage(image) { code, key in
    // key: Face recognition parameter
}

¶ Bind face photo

First face verification binding face. Before calling this interface, you need to call the Upload face photo interface to get the photo key value

func mfaAssociateByFace(photoKeyA: String, photoKeyB: String, completion: @escaping(Int, String?, UserInfo?) -> Void)

param

  • photoKeyA The Key from the first photo
  • photoKeyB The Key from the second photo

example

AuthClient().mfaAssociateByFace(photoKeyA: "photoKeyA", photoKeyB: "photoKeyB") { code, message, userInfo in
    // userInfo
}

¶ Face verification

Multi-factor authentication through face recognition. Before calling this interface, you need to call the upload face photo interface to get the photo key value

func mfaVerifyByFace(photoKey: String, completion: @escaping(Int, String?, UserInfo?) -> Void)

param

  • photoKey Key

example

AuthClient().mfaVerifyByFace(photoKey: "photoKey") { code, message, userInfo in
    // userInfo、
}

Prev: OIDC Next: User management
  • MFA check
  • SMS
  • Email
  • TOTP
  • Recovery code
  • Upload face photo
  • Bind face photo
  • Face verification

User identity management

Integrated third-party login
Mobile phone number flash check (opens new window)
Universal login form component
Custom authentication process

Enterprise internal management

Single Sign On
Multi-factor Authentication
Authority Management

Developers

Development Document
Framework Integration
Blog (opens new window)
GitHub (opens new window)
Community User Center (opens new window)

Company

400 888 2106
sales@authing.cn
16 / F, Block B, NORTH STAR CENTURY CENTER, Beijing(Total)
room 406, 4th floor, zone B, building 1, No. 200, Tianfu Fifth Street, Chengdu(branch)

Beijing ICP No.19051205-1

© Beijing Steamory Technology Co.