Allow users to authenticate with Face ID or Touch ID on iOS devices
npm install capacitor-face-id
!Build
Allow users to authenticate with Face ID or Touch ID on iOS devices
!Logo
``sh`
npm install capacitor-face-id
iOS requires the following usage description be added and filled out for your app in Info.plist:
Name: Privacy - Face ID Usage DescriptionNSFaceIDUsageDescription
Key:
`ts
import { Plugins, PluginResultError } from '@capacitor/core';
const { FaceId } = Plugins;
...
// check if device supports Face ID or Touch ID
FaceId.isAvailable().then(checkResult => {
if(checkResult.value) {
FaceId.auth().then(() => {
console.log('authenticated');
}).catch((error: PluginResultError) => {
// handle rejection errors
console.error(error.message);
});
} else {
// use custom fallback authentication here
}
});
`
| Method | Default | Type | Description |
| --------------------------------- | --------------------------------------------------- | ---------------------------- | ------------------------------------------------------------------- |
| isAvailable() | | Promise<{ value: string }> | Checks if Face ID or Touch ID is available, and returns type if so. |Promise
| auth(options?: {reason?: string}) | options: {reason: "Access requires authentication"} |