1# Obtaining Enrolled Credential Information 2 3 4The caller can obtain information about the credentials enrolled by the user to detect the change of the credentials (face, fingerprint, and password). 5 6 7## Available APIs 8 9For details about the parameters, return values, and error codes, see [getEnrolledState](../../reference/apis-user-authentication-kit/js-apis-useriam-userauth.md#userauthgetenrolledstate12). 10 11| API| Description| 12| -------- | -------- | 13| getEnrolledState(authType : UserAuthType): EnrolledState | Obtains the status of the enrolled credentials based on the specified authentication type.| 14 15 16## How to Develop 17 181. Check that the application has the ohos.permission.ACCESS_BIOMETRIC permission. For details about how to request permissions, see [Requesting Permissions](prerequisites.md#requesting-permissions). 19 202. Specify the authentication type ([UserAuthType](../../reference/apis-user-authentication-kit/js-apis-useriam-userauth.md#userauthtype8)) and call [getEnrolledState](../../reference/apis-user-authentication-kit/js-apis-useriam-userauth.md#userauthgetenrolledstate12) to obtain the status of the credentials enrolled by the user. 21 22Example: Obtain information about the credentials enrolled for facial authentication. 23 24```ts 25import { BusinessError } from '@kit.BasicServicesKit'; 26import { userAuth } from '@kit.UserAuthenticationKit'; 27 28try { 29 let enrolledState = userAuth.getEnrolledState(userAuth.UserAuthType.FACE); 30 console.info(`get current enrolled state success, enrolledState: ${JSON.stringify(enrolledState)}`); 31} catch (error) { 32 const err: BusinessError = error as BusinessError; 33 console.error(`get current enrolled state failed, Code is ${err?.code}, message is ${err?.message}`); 34} 35``` 36