1e41f4b71Sopenharmony_ci# @ohos.userIAM.userAuthIcon (Embedded User Authentication Icons) 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ciThe system provides the facial authentication icon and fingerprint authentication icon to simplify the user authentication process. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci- The icons for facial authentication and fingerprint authentication can be easily integrated into your applications. 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ci- The color and size of the icons can be customized, but the icon style cannot be changed. 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci- After you click the control icon, the face and fingerprint authentication controls are displayed in a pop-up window. 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci> **NOTE** 12e41f4b71Sopenharmony_ci> 13e41f4b71Sopenharmony_ci> The initial APIs of this module are supported since API version 12. Newly added APIs will be marked with a superscript to indicate their earliest API version. 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ci## Modules to Import 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci```ts 19e41f4b71Sopenharmony_ciimport { userAuth, UserAuthIcon } from '@kit.UserAuthenticationKit'; 20e41f4b71Sopenharmony_ci``` 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci## Child Components 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ciNone. 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_ci## Attributes 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_ciThe universal attributes are not supported. 31e41f4b71Sopenharmony_ci 32e41f4b71Sopenharmony_ci## UserAuthIcon 33e41f4b71Sopenharmony_ci 34e41f4b71Sopenharmony_ciUserAuthIcon({ 35e41f4b71Sopenharmony_ci authParam: userAuth.AuthParam, 36e41f4b71Sopenharmony_ci widgetParam: userAuth.WidgetParam, 37e41f4b71Sopenharmony_ci iconHeight?: Dimension, 38e41f4b71Sopenharmony_ci iconColor?: ResourceColor, 39e41f4b71Sopenharmony_ci onIconClick?: ()=>void, 40e41f4b71Sopenharmony_ci onAuthResult: (result: userAuth.UserAuthResult)=>void 41e41f4b71Sopenharmony_ci}) 42e41f4b71Sopenharmony_ci 43e41f4b71Sopenharmony_ci**Decorator**: @Component 44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 46e41f4b71Sopenharmony_ci 47e41f4b71Sopenharmony_ci**System capability**: SystemCapability.UserIAM.UserAuth.Core 48e41f4b71Sopenharmony_ci 49e41f4b71Sopenharmony_ci**Parameters** 50e41f4b71Sopenharmony_ci 51e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 52e41f4b71Sopenharmony_ci| -------------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ | 53e41f4b71Sopenharmony_ci| authParam | [AuthParam](js-apis-useriam-userauth.md#authparam10) | Yes | User authentication parameters. | 54e41f4b71Sopenharmony_ci| widgetParam | [WidgetParam](js-apis-useriam-userauth.md#widgetparam10) | Yes | Parameters on the user authentication page. | 55e41f4b71Sopenharmony_ci| iconHeight | [Dimension](../apis-arkui/arkui-ts/ts-types.md#dimension10) | No | Height of the icon. <br/>The aspect ratio is 1:1. <br/>The default value is **64**. | 56e41f4b71Sopenharmony_ci| iconColor | [ResourceColor](../apis-arkui/arkui-ts/ts-types.md#resourcecolor) | No | Color of the icon. The default value is **$r('sys.color.ohos_id_color_activated')**.| 57e41f4b71Sopenharmony_ci| onIconClick | ()=>void | No | Callback to be invoked when the icon is tapped. | 58e41f4b71Sopenharmony_ci| onAuthResult | (result: [UserAuthResult](js-apis-useriam-userauth.md#userauthresult10))=>void| Yes | Callback used to return the user authentication result.<br>**Required permissions**: ohos.permission.ACCESS_BIOMETRIC | 59e41f4b71Sopenharmony_ci 60e41f4b71Sopenharmony_ci 61e41f4b71Sopenharmony_ci## Events 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ciUniversal events are not supported. 64e41f4b71Sopenharmony_ci 65e41f4b71Sopenharmony_ci## Example 66e41f4b71Sopenharmony_ci 67e41f4b71Sopenharmony_ci```ts 68e41f4b71Sopenharmony_ciimport { userAuth, UserAuthIcon } from '@kit.UserAuthenticationKit'; 69e41f4b71Sopenharmony_ci 70e41f4b71Sopenharmony_ci@Entry 71e41f4b71Sopenharmony_ci@Component 72e41f4b71Sopenharmony_cistruct Index { 73e41f4b71Sopenharmony_ci authParam: userAuth.AuthParam = { 74e41f4b71Sopenharmony_ci challenge: new Uint8Array([49, 49, 49, 49, 49, 49]), 75e41f4b71Sopenharmony_ci authType: [userAuth.UserAuthType.FACE, userAuth.UserAuthType.PIN], 76e41f4b71Sopenharmony_ci authTrustLevel: userAuth.AuthTrustLevel.ATL3 77e41f4b71Sopenharmony_ci }; 78e41f4b71Sopenharmony_ci widgetParam: userAuth.WidgetParam = { 79e41f4b71Sopenharmony_ci title: 'Verify identity' 80e41f4b71Sopenharmony_ci }; 81e41f4b71Sopenharmony_ci 82e41f4b71Sopenharmony_ci build() { 83e41f4b71Sopenharmony_ci Row() { 84e41f4b71Sopenharmony_ci Column() { 85e41f4b71Sopenharmony_ci UserAuthIcon({ 86e41f4b71Sopenharmony_ci authParam: this.authParam, 87e41f4b71Sopenharmony_ci widgetParam: this.widgetParam, 88e41f4b71Sopenharmony_ci iconHeight: 200, 89e41f4b71Sopenharmony_ci iconColor: Color.Blue, 90e41f4b71Sopenharmony_ci onIconClick: () => { 91e41f4b71Sopenharmony_ci console.info('The user clicked the icon.'); 92e41f4b71Sopenharmony_ci }, 93e41f4b71Sopenharmony_ci onAuthResult: (result: userAuth.UserAuthResult) => { 94e41f4b71Sopenharmony_ci console.info('Get user auth result, result = ' + JSON.stringify(result)); 95e41f4b71Sopenharmony_ci } 96e41f4b71Sopenharmony_ci }) 97e41f4b71Sopenharmony_ci } 98e41f4b71Sopenharmony_ci } 99e41f4b71Sopenharmony_ci } 100e41f4b71Sopenharmony_ci} 101e41f4b71Sopenharmony_ci``` 102e41f4b71Sopenharmony_ci 103e41f4b71Sopenharmony_ciAn error may be thrown when **onAuthResult** is called. For details about the error codes, see [User Authentication Error Codes](errorcode-useriam.md). 104e41f4b71Sopenharmony_ci 105e41f4b71Sopenharmony_ci**Facial authentication icon** 106e41f4b71Sopenharmony_ci 107e41f4b71Sopenharmony_ci 108e41f4b71Sopenharmony_ci 109e41f4b71Sopenharmony_ci**Fingerprint authentication icon** 110e41f4b71Sopenharmony_ci 111e41f4b71Sopenharmony_ci 112