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
Property | Type | Default | Required | Description | Minimum Version |
---|---|---|---|---|---|
secretData | string | true | Khoá 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 | |
ui | object | 2.5.3 | |||
requireFingerprint | boolean | Chỉ sử dụng vân tay. Hỗ trợ Android | 2.5.3 | ||
success | function | Callback function khi gọi api thành công | 2.5.3 | ||
fail | function | Callback function khi gọi api thất bại | 2.5.3 |
UI Object
Property | Type | Default | Required | Description | Minimum Version |
---|---|---|---|---|---|
title | string | "Xác thực" | Tiêu đề form xác thực | ||
subTitle | string | "Sử dụng sinh trắc học của bạn để xác thực" | Nội dung hướng dẫn | ||
negativeButtonText | string | "Đó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;
}
};