my.checkLocalBioAuthSupported
The my.checkLocalBioAuthSupported JSAPI is called by mini programs to check the availability of biometric authentication on the user's device.
Request parameter
Field | Data type | Required | Description |
success | Function | No | The callback that is executed when biometric authentication is available on the user's device. If you need to set callbacks for this JSAPI, either specify this parameter and the fail parameter or specify the complete parameter. |
fail | Function | No | The callback that is executed when biometric authentication is unavailable on the user's device. If you need to set callbacks for this JSAPI, either specify this parameter and the success parameter or specify the complete parameter. |
complete | Function | No | The callback that is executed when the biometric authentication check completes, regardless of the feature's availability. If you need to set callbacks for this JSAPI, either specify this parameter or specify the success and the fail parameters. |
Response parameter
Field | Data type | Required | Description |
success | Boolean | No | Whether biometric authentication is available on the user's device. This parameter is returned if the success or complete callback function is executed. Valid values are:
|
error | Number | No | The error code. For more information, refer to Error codes. This parameter is returned if the fail callback function is executed or if the success response parameter is set to |
errorMessage | String | No | The error message that corresponds to the error code. For more information, refer to Error codes. This parameter is returned if the fail callback function is executed or if the success response parameter is set to |
Error codes
Error code | Error message |
12 | Either the device lacks biometric support or the super app cannot access the biometric feature. |
13 | Biometric credentials are not enabled on the user's device. |
99 | An undefined error has occurred. Please contact technical support for assistance. |
Sample code
The following sample code shows how to call the my.checkLocalBioAuthSupported JSAPI:
my.checkLocalBioAuthSupported({
success: (res) => {
console.log(res)
},
fail: (res) => {
console.log(res)
},
});