# Face Login

Face Login authenticates a user by performing a face match between a captured selfie and a previously enrolled face. Call `startFaceLogin()` to authenticate an enrolled user. The only argument is an optional `sessionConfig` object.

## Prerequisites

- The SDK is initialized. See [Installation](#).
- The user has an approved account with an enrolled face.

Enrollment happens as a byproduct of a standard onboarding flow that includes the `addFaceMatch` module. Alternatively, an admin can enroll a user by clicking **Add face to Database** in Dashboard.

## Start Face Login

```javascript
cordova.exec(
  function (result) { console.log(JSON.stringify(result)); },
  function (err) { console.log(err); },
  "Cplugin",
  "startFaceLogin",
  []  // or [{ e2eEncryptionEnabled: true }] on Android for E2EE
);
```

## FaceLoginResult

`FaceLoginResult` contains the following fields:

- `image`: object. Selfie image captured during login.
- `spoofAttempt`: bool. `true` indicates the user tried to spoof the system (using a photo, screen, or other method). `false` indicates a real person.
- `faceMatched`: bool. `true` if the faces matched, `false` otherwise.
- `customerUUID`: string or `null`. Unique user identifier if authentication succeeded. `null` if `faceMatched` is `false`.
- `interviewId`: string. Session ID in which the user was approved.
- `interviewToken`: string. Session token in which the user was approved.
- `token`: string. Token that can be used for further API calls.
- `transactionId`: string. Unique identifier of the Face Login attempt.
- `hasFaceMask`: bool. Indicator if the login attempt failed because the user was wearing a face mask.

## End-to-End Encryption (E2EE)

<Callout icon="📘" theme="info">
  ### Android only

  End-to-End Encryption (E2EE) for Face Login is supported on Android only.
</Callout>

By default, Face Login does not use E2EE. To enable it, set `e2eEncryptionEnabled` to `true`.

```javascript
// Android only; requires e2eeUrl in initializeSDK
cordova.exec(success, error, "Cplugin", "startFaceLogin", [
  { e2eEncryptionEnabled: true }
]);
```

See [End-to-End Encryption (E2EE)](#) for full E2EE setup.

<br />
