¶ MFA API
Update Time: 2026-03-25 09:13:34
¶ MFA check
Check if phone number or email address can be used for MFA
public static void mfaCheck(String phone, String email, @NotNull AuthCallback<JSONObject> callback)
param
phonephone number to be checked. can be nullemailemail address to be checked. can be null
example
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) {
}
}
});
¶ SMS
MFA by SMS
public static void mfaVerifyByPhone(String phone, String code, @NotNull AuthCallback<UserInfo> callback)
param
phonephone numbercodeSMS verification code
example
AuthClient.mfaVerifyByPhone("188xxxx8888", "1234", (code, message, userInfo)->{
});
MFA by email
public static void mfaVerifyByEmail(String email, String code, @NotNull AuthCallback<UserInfo> callback)
param
emailemail addresscodeemail verification code
example
AuthClient.mfaVerifyByEmail("abc@gmail.com", "1234", (code, message, userInfo)->{
});
¶ TOTP
MFA by TOTP (Time-based One Time Password)
public static void mfaVerifyByTOTP(String code, @NotNull AuthCallback<UserInfo> callback)
param
codeTOTP code
example
AuthClient.mfaVerifyByTOTP("1234", (code, message, 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
public static void mfaVerifyByRecoveryCode(String code, @NotNull AuthCallback<UserInfo> callback)
param
coderecovery code
example
AuthClient.mfaVerifyByRecoveryCode("1234", (code, message, userInfo)->{
// new recovery code
String newCode = userInfo.getRecoveryCode();
});
¶ Unbind the MFA phone number
Unbind the MFA phone number。
public static void unBindMfaPhone(@NotNull AuthCallback<JSONObject> callback)
example
AuthClient.unBindMfaPhone((code, message, data)->{
if (code == 200) {
//successful
}
});
¶ Unbind the MFA email
Unbind the MFA email。
public static void unBindMfaEmail(@NotNull AuthCallback<JSONObject> callback)
example
AuthClient.unBindMfaEmail((code, message, data)->{
if (code == 200) {
//successful
}
});