Nhảy tới nội dung

openBioAuthentication

Bắt đầu hỗ trợ ở phiên bản:

  • SDK: 2.5.3
Lưu ý

Cần xin cấp quyền tại trang Quản lý ứng dụng

Cho phép ứng dụng mở giao diện đăng nhập sinh trắc học của thiết bị. Lưu ý: Chỉ hỗ trợ các OS chuẩn không bị Root hoặc Jailbreak.

Parameters​

Object object​

PropertyTypeDefaultRequiredDescriptionMinimum Version
secretDatastringtrueKhoá bí mật, dùng một lần cho quá trình xác thực. Bạn có thể tạo secretData = hash(accessToken + eventTime)2.5.3
uiobject2.5.3
requireFingerprintbooleanChỉ sử dụng vân tay. Hỗ trợ Android2.5.3
successfunctionCallback function khi gọi api thành công2.5.3
failfunctionCallback function khi gọi api thất bại2.5.3

UI Object​

PropertyTypeDefaultRequiredDescriptionMinimum Version
titlestring"Xác thực"Tiêu đề form xác thực
subTitlestring"Sử dụng sinh trắc học của bạn để xác thực"Nội dung hướng dẫn
negativeButtonTextstring"Đóng"Tiêu đề của Button thoát

Sample code​

import { openBioAuthentication } from "zmp-sdk/apis";

openBioAuthentication({
secretData: "<secretData>",
ui: {
title: "Biometric login for my app",
subTitle: "Log in using your biometric credential",
negativeButtonText: "Cancel",
},
success: (data) => {},
fail: (error) => {
const { code } = error;
},
});

Hoặc

import { openBioAuthentication } from "zmp-sdk/apis";

const openBioAuthenUI = async () => {
try {
const data = await openBioAuthentication({
secretData: "<secretData>",
ui: {
title: "Biometric login for my app",
subTitle: "Log in using your biometric credential",
negativeButtonText: "Cancel",
},
});
} catch (error) {
const { code } = error;
}
};

Errors​

Bắt đầu hỗ trợ:

  • API phiên bản: 2.21.0
CodeError
108Xác thực quá nhiều lần => Đã bị khóa Biometic
103Xác thực không thành công (Bấm nhập mật khẩu - iOS)
102Hủy xác thực
101Xác thực thất bại 3 lần (Android)
100Unknown error