>The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import<a name="s56d19203690d4782bfc74069abb6bd71"></a>
Obtains an **Authenticator** object for user authentication. <sup>6+</sup>
> **NOTE**<br/>
> This API is not longer maintained since API version 8. You are advised to use [constructor](#constructor8).
Obtains an **Authenticator** object to check the device's capability of user authentication, perform or cancel user authentication, and obtain the tips generated in the authentication process. <sup>7+</sup>
Obtains an **Authenticator** object for user authentication.
| level | string | Yes | Security level of the authentication. It can be S1 (lowest), S2, S3, or S4 (highest).<br>Devices capable of 3D facial recognition support S3 and lower-level authentication.<br>Devices capable of 2D facial recognition support S2 and lower-level authentication.|
</th>
| callback | AsyncCallback<number> | No | Callback used to return the result. |
<p id="p18764165418403"><a name="p18764165418403"></a><a name="p18764165418403"></a><strong id="b16718485101"><a name="b16718485101"></a><a name="b16718485101"></a>ALL</strong> is reserved and not supported by the current version.</p>
<td class="cellrowborder" valign="top" width="58.18%" headers="mcps1.1.5.1.4 "><p id="p154361901865"><a name="p154361901865"></a><a name="p154361901865"></a>Security level of the authentication. It can be <strong id="b82810554407"><a name="b82810554407"></a><a name="b82810554407"></a>S1</strong> (lowest), <strong id="b3281185516404"><a name="b3281185516404"></a><a name="b3281185516404"></a>S2</strong>, <strong id="b128245518408"><a name="b128245518408"></a><a name="b128245518408"></a>S3</strong>, or <strong id="b8282195554014"><a name="b8282195554014"></a><a name="b8282195554014"></a>S4</strong> (highest).</p>
<p id="p14362004616"><a name="p14362004616"></a><a name="p14362004616"></a>Devices capable of 3D facial recognition support S3 and lower-level authentication.</p>
<p id="p643610065"><a name="p643610065"></a><a name="p643610065"></a>Devices capable of 2D facial recognition support S2 and lower-level authentication.</p>
</td>
> **NOTE**<br/>
</tr>
> This API is not longer maintained since API version 8. You are advised to use [auth](#auth8).
| type | string | Yes | Authentication type. Only **FACE_ONLY** is supported.<br>**ALL** is reserved and not supported by the current version.|
| level | string | Yes | Security level of the authentication. It can be S1 (lowest), S2, S3, or S4 (highest).<br>Devices capable of 3D facial recognition support S3 and lower-level authentication.<br>Devices capable of 2D facial recognition support S2 and lower-level authentication.|
| Promise<number> | Promise used to return the authentication result, which is a number. For details, see [AuthenticationResult](#authenticationresultdeprecated).|
<td class="cellrowborder" valign="top" width="70.17999999999999%" headers="mcps1.1.5.1.4 "><p id="p19109111735111"><a name="p19109111735111"></a><a name="p19109111735111"></a>Authentication type. Only <strong id="b7977192195712"><a name="b7977192195712"></a><a name="b7977192195712"></a>FACE_ONLY</strong> is supported.</p>
<p id="p33401722105117"><a name="p33401722105117"></a><a name="p33401722105117"></a><strong id="b810618395"><a name="b810618395"></a><a name="b810618395"></a>ALL</strong> is reserved and not supported by the current version.</p>
<td class="cellrowborder" valign="top" width="70.17999999999999%" headers="mcps1.1.5.1.4 "><p id="p785974215531"><a name="p785974215531"></a><a name="p785974215531"></a>Security level of the authentication. It can be <strong id="b15960143804616"><a name="b15960143804616"></a><a name="b15960143804616"></a>S1</strong> (lowest), <strong id="b896033844616"><a name="b896033844616"></a><a name="b896033844616"></a>S2</strong>, <strong id="b1096013819464"><a name="b1096013819464"></a><a name="b1096013819464"></a>S3</strong>, or <strong id="b99601438144615"><a name="b99601438144615"></a><a name="b99601438144615"></a>S4</strong> (highest).</p>
<p id="p7109181716519"><a name="p7109181716519"></a><a name="p7109181716519"></a>Devices capable of 3D facial recognition support S3 and lower-level authentication.</p>
<p id="p121090173514"><a name="p121090173514"></a><a name="p121090173514"></a>Devices capable of 2D facial recognition support S2 and lower-level authentication.</p>
<td class="cellrowborder" valign="top" width="82.49%" headers="mcps1.1.3.1.2 "><p id="p26666151431"><a name="p26666151431"></a><a name="p26666151431"></a>Promise used to return the authentication result. The number in the promise indicates the authentication result. See <a href="#section71321544144418">AuthenticationResult</a>.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let authenticator = userIAM_userAuth.getAuthenticator();
<td class="cellrowborder" valign="top" width="82.49%" headers="mcps1.1.3.1.2 "><p id="p3590102592516"><a name="p3590102592516"></a><a name="p3590102592516"></a>Whether the authentication is canceled. For details, see <a href="#section593513424528">Result</a>.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let authenticator = userIAM_userAuth.getAuthenticator();
let cancelCode = authenticator.cancel();
if (cancelCode == userIAM_userAuth.Result.SUCCESS) {
<td class="cellrowborder" valign="top" width="70.17999999999999%" headers="mcps1.1.5.1.4 "><p id="p8242134416410"><a name="p8242134416410"></a><a name="p8242134416410"></a>Authentication type. Only <strong id="b1035323028"><a name="b1035323028"></a><a name="b1035323028"></a>FACE_ONLY</strong> is supported.</p>
<p id="p1924244411416"><a name="p1924244411416"></a><a name="p1924244411416"></a><strong id="b553343868"><a name="b553343868"></a><a name="b553343868"></a>ALL</strong> is reserved and not supported by the current version.</p>
<td class="cellrowborder" valign="top" width="70.17999999999999%" headers="mcps1.1.5.1.4 "><p id="p7242164415411"><a name="p7242164415411"></a><a name="p7242164415411"></a>Security level of the authentication. It can be <strong id="b333736859"><a name="b333736859"></a><a name="b333736859"></a>S1</strong> (lowest), <strong id="b1107708564"><a name="b1107708564"></a><a name="b1107708564"></a>S2</strong>, <strong id="b661259336"><a name="b661259336"></a><a name="b661259336"></a>S3</strong>, or <strong id="b1867933861"><a name="b1867933861"></a><a name="b1867933861"></a>S4</strong> (highest).</p>
<p id="p11242164412416"><a name="p11242164412416"></a><a name="p11242164412416"></a>Devices capable of 3D facial recognition support S3 and lower-level authentication.</p>
<p id="p1242144464114"><a name="p1242144464114"></a><a name="p1242144464114"></a>Devices capable of 2D facial recognition support S2 and lower-level authentication.</p>
<td class="cellrowborder" valign="top" width="70.17999999999999%" headers="mcps1.1.5.1.4 "><p id="p1883201115259"><a name="p1883201115259"></a><a name="p1883201115259"></a>Event type. Currently, only <strong id="b745040141017"><a name="b745040141017"></a><a name="b745040141017"></a>tip</strong> is supported. An event is triggered when the authentication service sends a message to the caller.</p>
<td class="cellrowborder" valign="top" width="70.17999999999999%" headers="mcps1.1.5.1.4 "><p id="p183662056132512"><a name="p183662056132512"></a><a name="p183662056132512"></a>Callback used to report the event of the specified type. Currently, only the <strong id="b10471104135112"><a name="b10471104135112"></a><a name="b10471104135112"></a>tip</strong> event is supported.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let authenticator = userIAM_userAuth.getAuthenticator();
<td class="cellrowborder" valign="top" width="70.17999999999999%" headers="mcps1.1.5.1.4 "><p id="p18601727103313"><a name="p18601727103313"></a><a name="p18601727103313"></a>Callback used to report the event of the specified type. Currently, only the <strong id="b57354610564"><a name="b57354610564"></a><a name="b57354610564"></a>tip</strong> event is supported. If this parameter is not specified, all callbacks corresponding to <strong id="b947313614579"><a name="b947313614579"></a><a name="b947313614579"></a>type</strong> will be canceled.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let authenticator = userIAM_userAuth.getAuthenticator();
| INVALID_PARAMETERS | 6 | The authentication parameters are invalid. |
</td>
| LOCKED | 7 | The user account is locked because the number of authentication failures has reached the threshold.|
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p17670193413127"><aname="p17670193413127"></a><aname="p17670193413127"></a>The device does not support the current authentication mode.</p>
| NOT_ENROLLED | 8 | No authentication credential is registered. |
Provides methods to manage an **Authenticator** object.
</td>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p10670234121217"><aname="p10670234121217"></a><aname="p10670234121217"></a>The authentication is successful.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p15211163612131"><aname="p15211163612131"></a><aname="p15211163612131"></a>The user cancels the authentication.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p18244945171311"><aname="p18244945171311"></a><aname="p18244945171311"></a>The camera failed to start.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p1523004718135"><aname="p1523004718135"></a><aname="p1523004718135"></a>The authentication service is not available. Try again later.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p4642175118131"><aname="p4642175118131"></a><aname="p4642175118131"></a>The user account is locked because the number of authentication failures has reached the threshold.</p>
<tdclass="cellrowborder"valign="top"width="59.245924592459254%"headers="mcps1.1.5.1.4 "><pid="p109351224253"><aname="p109351224253"></a><aname="p109351224253"></a>Whether the tip is obtained successfully. For details, see <ahref="#section593513424528">Result</a>.</p>
<tdclass="cellrowborder"valign="top"width="59.245924592459254%"headers="mcps1.1.5.1.4 "><pid="p750191318235"><aname="p750191318235"></a><aname="p750191318235"></a>Tip event. For details, see <ahref="#section1153812013016">TipEvent</a>. Currently, only <strongid="b395253613581"><aname="b395253613581"></a><aname="b395253613581"></a>RESULT</strong> and <strongid="b463344015819"><aname="b463344015819"></a><aname="b463344015819"></a>ACQUIRE</strong> are supported.</p>
<aname="ul27904101853"></a><aname="ul27904101853"></a><ulid="ul27904101853"><li>If <strongid="b274502255918"><aname="b274502255918"></a><aname="b274502255918"></a>tipEvent</strong> is <strongid="b861743319598"><aname="b861743319598"></a><aname="b861743319598"></a>RESULT</strong>, the tip code provides the authentication result. For details, see <ahref="#section71321544144418">AuthenticationResult</a>.</li><li>If <strongid="b3416111616017"><aname="b3416111616017"></a><aname="b3416111616017"></a>tipEvent</strong> is <strongid="b3305420604"><aname="b3305420604"></a><aname="b3305420604"></a>ACQUIRE</strong>, the tip code provides prompt information. For details, see <ahref="#section169263103510">TipCode</a>.</li></ul>
<tdclass="cellrowborder"valign="top"width="59.245924592459254%"headers="mcps1.1.5.1.4 "><pid="p423623152215"><aname="p423623152215"></a><aname="p423623152215"></a>Description of the tip code.</p>
| result | number | Yes | Authentication result obtained. For details, see [ResultCode](#resultcode8). |
| extraInfo | [AuthResult](#authresult8) | Yes | Extended information, which varies depending on the authentication result.<br>If the authentication is successful, the user authentication token will be returned in **extraInfo**.<br>If the authentication fails, the remaining number of authentication times will be returned in **extraInfo**.<br>If the authenticator is locked, the freeze time will be returned in **extraInfo**.|
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p1437811075710"><aname="p1437811075710"></a><aname="p1437811075710"></a>The device supports the specified authentication type and security level.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p1137840205720"><aname="p1137840205720"></a><aname="p1137840205720"></a>The device does not support the specified authentication type.</p>
| FINGERPRINT_AUTH_TIP_TOO_FAST | 4 | The fingerprint image is incomplete due to fast movement. |
</td>
| FINGERPRINT_AUTH_TIP_TOO_SLOW | 5 | Failed to obtain the fingerprint image because the finger seldom moves. |
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p237840165715"><aname="p237840165715"></a><aname="p237840165715"></a>The device does not support the specified authentication security level.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p937920155713"><aname="p937920155713"></a><aname="p937920155713"></a>The device does not support distributed authentication.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p237916017577"><aname="p237916017577"></a><aname="p237916017577"></a>The device does not have the authentication credential.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p24521077564"><aname="p24521077564"></a><aname="p24521077564"></a>The number of parameters is incorrect.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p8786917340"><aname="p8786917340"></a><aname="p8786917340"></a>Credential enrollment result or authentication result.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p11818511209"><aname="p11818511209"></a><aname="p11818511209"></a>Tips generated in the credential enrollment or authentication process.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p14819518014"><aname="p14819518014"></a><aname="p14819518014"></a>Index of a face authentication credential.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p1946219513511"><aname="p1946219513511"></a><aname="p1946219513511"></a>The obtained facial image is too bright due to high illumination.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p204622513511"><aname="p204622513511"></a><aname="p204622513511"></a>The obtained facial image is too dark due to low illumination.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p17462135114510"><aname="p17462135114510"></a><aname="p17462135114510"></a>The face is too close to the device.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p046255119510"><aname="p046255119510"></a><aname="p046255119510"></a>The face is too far away from the device.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p3462751456"><aname="p3462751456"></a><aname="p3462751456"></a>Only the upper part of the face is captured because the device is angled too high.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p1046235115511"><aname="p1046235115511"></a><aname="p1046235115511"></a>Only the lower part of the face is captured because the device is angled too low.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p146213517514"><aname="p146213517514"></a><aname="p146213517514"></a>Only the right part of the face is captured because the device is deviated to the right.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p846317510516"><aname="p846317510516"></a><aname="p846317510516"></a>Only the left part of the face is captured because the device is deviated to the left.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p24631551257"><aname="p24631551257"></a><aname="p24631551257"></a>The face moves too fast during facial information collection.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p746315511457"><aname="p746315511457"></a><aname="p746315511457"></a>The face is not facing the camera.</p>
<tdclass="cellrowborder"valign="top"width="61.019999999999996%"headers="mcps1.1.4.1.3 "><pid="p1446319511451"><aname="p1446319511451"></a><aname="p1446319511451"></a>No face is detected.</p>