GenAuth DocsDocuments
Concepts
User Guide
Development Integration
AgentAuth
Metadata
Development Integration
Multi-tenant (beta)
Console Documentation
Multi-tenant Console
Tenant Console
Saas Application Demo
Concepts
User Guide
Development Integration
AgentAuth
Metadata
Development Integration
Multi-tenant (beta)
Console Documentation
Multi-tenant Console
Tenant Console
Saas Application Demo
Old version
  • Single Page Web Application

  • Mobile and Client Applications

    • Android

      • Quick Start
      • Hosted Pages
      • Components

      • APIs

        • 核心认证 API
        • 标准协议 API
        • 多因素认证 API
        • 扫码认证 API
      • Social Login

      • Typical Scenarios

      • Private Deployment
      • Version History
    • C#

    • Flutter

    • iOS

    • React Native
  • Standard Web Application

  • Framework Integration

  • Others

  1. Development Integration
  2. /
  3. Mobile and Client Applications
  4. /
  5. Android
  6. /
  7. APIs
  8. /
  9. 多因素认证 API

¶ 多因素认证 API

Update time: 2025-07-23 07:34:21
Edit

¶ MFA 检测

检测手机号或者邮箱是否可以被用作 MFA

public static void mfaCheck(String phone, String email, @NotNull AuthCallback<JSONObject> callback)

参数

  • phone 被检测的手机号。可以为空
  • email 被检测的邮箱。可以为空

示例

AuthClient.mfaCheck("188xxxx8888", null, (code, message, ok) -> {
    if (code == 200) {
        if (ok) {
            
        }
    }
});

AuthClient.mfaCheck(null, "abc@gmail.com", (code, message, ok) -> {
    if (code == 200) {
        if (ok) {
            
        }
    }
});

¶ 短信验证

通过短信进行多因素认证

public static void mfaVerifyByPhone(String phone, String code, @NotNull AuthCallback<UserInfo> callback)

参数

  • phone 手机号码
  • code 短信验证码

示例

AuthClient.mfaVerifyByPhone("188xxxx8888", "1234", (code, message, userInfo)->{
    // userInfo 用户信息
});

¶ 邮箱验证

通过邮件验证码进行多因素认证

public static void mfaVerifyByEmail(String email, String code, @NotNull AuthCallback<UserInfo> callback)

参数

  • email 邮箱地址
  • code 邮件验证码

示例

AuthClient.mfaVerifyByEmail("abc@gmail.com", "1234", (code, message, userInfo)->{
    // userInfo 用户信息
});

¶ TOTP 验证

通过一次性密码 TOTP (Time-based One Time Password) 进行多因素认证

public static void mfaVerifyByTOTP(String code, @NotNull AuthCallback<UserInfo> callback)

参数

  • code TOTP code

示例

AuthClient.mfaVerifyByTOTP("1234", (code, message, userInfo)->{
    // userInfo 用户信息
});

¶ 恢复码验证

用户在绑定 TOTP 时会得到一个恢复码,用户需要安全保存该恢复码,在调用此 API 时,将其作为参数传入。

注意,恢复码验证成功后,会生成新的恢复码,旧的恢复码失效

public static void mfaVerifyByRecoveryCode(String code, @NotNull AuthCallback<UserInfo> callback)

参数

  • code 恢复码

示例

AuthClient.mfaVerifyByRecoveryCode("1234", (code, message, userInfo)->{
    // 新的恢复码
    String newCode = userInfo.getRecoveryCode();
});

Previous article: 标准协议 API Next article: 扫码认证 API
  • MFA 检测
  • 短信验证
  • 邮箱验证
  • TOTP 验证
  • 恢复码验证

User identity management

Integrated third-party login
Customized authentication process

Enterprise internal management

Single sign-on
Multi-factor authentication
Permission management

Developer

Development Documentation
GitHub (opens new window)

Company

official@genauth.ai
16th Floor, Building B, Beichen Century Center, Chaoyang District, Beijing (Total)
Room 406, 4th Floor, Block B, No. 200, Tianfu Fifth Street, High-tech Zone, Chengdu (Branch)

© Beijing Steamory Technology Co., Ltd.