1e41f4b71Sopenharmony_ci# User IAM Subsystem Changelog 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci## cl.useriam.1 Deprecation of AuthEvent 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci**Access Level** 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ciPublic 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci**Reason for Change** 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ciThe user authentication widget is used to implement user identity authentication to ensure consistent user experience. The APIs of the original user identity authentication are deprecated. 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci**Change Impact** 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ciThis change is a compatible change. The use of deprecated APIs is not affected. 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci**API Level** 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci8 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci**Change Since** 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ciOpenHarmony SDK 4.1.6.2 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci**Deprecated APIs/Components** 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci| API| Description| Substitute API| 28e41f4b71Sopenharmony_ci|---------|----------|--------| 29e41f4b71Sopenharmony_ci| interface AuthEvent | This API is deprecated. Use **IAuthCallback** instead.| interface IAuthCallback | 30e41f4b71Sopenharmony_ci| callback(result: EventInfo): void | This API is deprecated. Use **onResult** in **IAuthCallback** instead.| method onResult | 31e41f4b71Sopenharmony_ci| field AuthEventKey | This API is deprecated.| N/A| 32e41f4b71Sopenharmony_ci| type EventInfo | This API is deprecated. Use **UserAuthResult** in **IAuthCallback** instead.| interface UserAuthResult | 33e41f4b71Sopenharmony_ci| interface AuthResultInfo | This API is deprecated.| N/A| 34e41f4b71Sopenharmony_ci| field result | This API is deprecated. Use **result** in **UserAuthResult** instead.| field result | 35e41f4b71Sopenharmony_ci| field token | This API is deprecated. Use **token** in **UserAuthResult** instead.| field token | 36e41f4b71Sopenharmony_ci| field remainAttempts | This API is deprecated.| N/A| 37e41f4b71Sopenharmony_ci| field lockoutDuration | This API is deprecated.| N/A| 38e41f4b71Sopenharmony_ci| interface TipInfo | This API is deprecated.| N/A| 39e41f4b71Sopenharmony_ci| field module | This API is deprecated.| N/A| 40e41f4b71Sopenharmony_ci| field tip | This API is deprecated.| N/A| 41e41f4b71Sopenharmony_ci| enum_class FingerprintTips | This API is deprecated.| N/A| 42e41f4b71Sopenharmony_ci| enum_instance FINGERPRINT_AUTH_TIP_TOO_SLOW | This API is deprecated.| N/A| 43e41f4b71Sopenharmony_ci| enum_instance FINGERPRINT_AUTH_TIP_TOO_FAST | This API is deprecated.| N/A| 44e41f4b71Sopenharmony_ci| enum_instance FINGERPRINT_AUTH_TIP_PARTIAL | This API is deprecated.| N/A| 45e41f4b71Sopenharmony_ci| enum_instance FINGERPRINT_AUTH_TIP_INSUFFICIENT | This API is deprecated.| N/A| 46e41f4b71Sopenharmony_ci| enum_instance FINGERPRINT_AUTH_TIP_DIRTY | This API is deprecated.| N/A| 47e41f4b71Sopenharmony_ci| enum_instance FINGERPRINT_AUTH_TIP_GOOD | This API is deprecated.| N/A| 48e41f4b71Sopenharmony_ci| enum_class FaceTips | This API is deprecated.| N/A| 49e41f4b71Sopenharmony_ci| enum_instance FACE_AUTH_TIP_TOO_BRIGHT | This API is deprecated.| N/A| 50e41f4b71Sopenharmony_ci| enum_instance FACE_AUTH_TIP_TOO_DARK | This API is deprecated.| N/A| 51e41f4b71Sopenharmony_ci| enum_instance FACE_AUTH_TIP_TOO_CLOSE | This API is deprecated.| N/A| 52e41f4b71Sopenharmony_ci| enum_instance FACE_AUTH_TIP_TOO_FAR | This API is deprecated.| N/A| 53e41f4b71Sopenharmony_ci| enum_instance FACE_AUTH_TIP_TOO_HIGH | This API is deprecated.| N/A| 54e41f4b71Sopenharmony_ci| enum_instance FACE_AUTH_TIP_TOO_LOW | This API is deprecated.| N/A| 55e41f4b71Sopenharmony_ci| enum_instance FACE_AUTH_TIP_TOO_RIGHT | This API is deprecated.| N/A| 56e41f4b71Sopenharmony_ci| enum_instance FACE_AUTH_TIP_TOO_LEFT | This API is deprecated.| N/A| 57e41f4b71Sopenharmony_ci| enum_instance FACE_AUTH_TIP_TOO_MUCH_MOTION | This API is deprecated.| N/A| 58e41f4b71Sopenharmony_ci| enum_instance FACE_AUTH_TIP_POOR_GAZE | This API is deprecated.| N/A| 59e41f4b71Sopenharmony_ci| enum_instance FACE_AUTH_TIP_NOT_DETECTED | This API is deprecated.| N/A| 60e41f4b71Sopenharmony_ci 61e41f4b71Sopenharmony_ci**Adaptation Guide** 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ciFor example, replace the callback in **AuthEvent** with **onResult** of **IAuthCallback**. The sample code is as follows: 64e41f4b71Sopenharmony_ci 65e41f4b71Sopenharmony_ci```js 66e41f4b71Sopenharmony_ciimport userIAM_userAuth from '@ohos.userIAM.userAuth'; 67e41f4b71Sopenharmony_ci 68e41f4b71Sopenharmony_cilet challenge = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]); 69e41f4b71Sopenharmony_cilet authType = userIAM_userAuth.UserAuthType.FACE; 70e41f4b71Sopenharmony_cilet authTrustLevel = userIAM_userAuth.AuthTrustLevel.ATL1; 71e41f4b71Sopenharmony_citry { 72e41f4b71Sopenharmony_ci let auth = userIAM_userAuth.getAuthInstance(challenge, authType, authTrustLevel); 73e41f4b71Sopenharmony_ci auth.on('result', { 74e41f4b71Sopenharmony_ci // In API version 9, the callback in AuthEvent returns the authentication result. 75e41f4b71Sopenharmony_ci callback: (result: userIAM_userAuth.AuthResultInfo) => { 76e41f4b71Sopenharmony_ci console.log('authV9 result ' + result.result); 77e41f4b71Sopenharmony_ci console.log('authV9 token ' + result.token); 78e41f4b71Sopenharmony_ci console.log('authV9 remainAttempts ' + result.remainAttempts); 79e41f4b71Sopenharmony_ci console.log('authV9 lockoutDuration ' + result.lockoutDuration); 80e41f4b71Sopenharmony_ci } 81e41f4b71Sopenharmony_ci } as userIAM_userAuth.AuthEvent); 82e41f4b71Sopenharmony_ci auth.start(); 83e41f4b71Sopenharmony_ci console.log('authV9 start success'); 84e41f4b71Sopenharmony_ci} catch (error) { 85e41f4b71Sopenharmony_ci console.error('authV9 error = ' + error); 86e41f4b71Sopenharmony_ci // do error 87e41f4b71Sopenharmony_ci} 88e41f4b71Sopenharmony_ci``` 89e41f4b71Sopenharmony_ci 90e41f4b71Sopenharmony_ci```js 91e41f4b71Sopenharmony_ciimport userAuth from '@ohos.userIAM.userAuth'; 92e41f4b71Sopenharmony_ci 93e41f4b71Sopenharmony_ciconst authParam : userAuth.AuthParam = { 94e41f4b71Sopenharmony_ci challenge: new Uint8Array([49, 49, 49, 49, 49, 49]), 95e41f4b71Sopenharmony_ci authType: [userAuth.UserAuthType.PIN], 96e41f4b71Sopenharmony_ci authTrustLevel: userAuth.AuthTrustLevel.ATL1, 97e41f4b71Sopenharmony_ci}; 98e41f4b71Sopenharmony_ciconst widgetParam :userAuth.WidgetParam = { 99e41f4b71Sopenharmony_ci title: 'Enter password', 100e41f4b71Sopenharmony_ci}; 101e41f4b71Sopenharmony_citry { 102e41f4b71Sopenharmony_ci let userAuthInstance = userAuth.getUserAuthInstance(authParam, widgetParam); 103e41f4b71Sopenharmony_ci console.log('get userAuth instance success'); 104e41f4b71Sopenharmony_ci // The authentication result is returned by onResult only after the authentication is started by start() of UserAuthInstance. 105e41f4b71Sopenharmony_ci userAuthInstance.on('result', { 106e41f4b71Sopenharmony_ci // Since API version 10, the onResult callback of IAuthCallback returns the authentication result. 107e41f4b71Sopenharmony_ci onResult (result) { 108e41f4b71Sopenharmony_ci console.log('userAuthInstance callback result = ' + JSON.stringify(result)); 109e41f4b71Sopenharmony_ci } 110e41f4b71Sopenharmony_ci }); 111e41f4b71Sopenharmony_ci console.log('auth on success'); 112e41f4b71Sopenharmony_ci} catch (error) { 113e41f4b71Sopenharmony_ci console.error('auth catch error: ' + JSON.stringify(error)); 114e41f4b71Sopenharmony_ci} 115e41f4b71Sopenharmony_ci``` 116e41f4b71Sopenharmony_ci 117e41f4b71Sopenharmony_ciFor more information, see [User Authentication](../../../application-dev/reference/apis-user-authentication-kit/js-apis-useriam-userauth.md) and [Facial Authentication](../../../application-dev/reference/apis-user-authentication-kit/js-apis-useriam-faceauth-sys.md). 118