# Kiosk mode features

Kiosk mode is used for building iPad apps where an iPad is embedded into an Aila frame and positioned in a landscape orientation.

## Initialize IncdOnboarding SDK

Add the following line of code to your `AppDelegate` class:

```undefined
IncdOnboardingManager.shared.initIncdOnboarding(url: url, apiKey: apiKey)
```

`url` and `apiKey` will be provided to you by Incode.

If you're running the app on a simulator, please set the `testMode` parameter to true.

## Kiosk 1:N Face Login - Identify a user

1:N Face login is suitable if you would like to identify a user by doing a face scan.

This will do a face match comparison across your entire user database and check if the face corresponds to any of the approved users.

To execute 1:N Face Login call `startFaceLogin` method:

```undefined
IncdOnboardingManager.shared.startKioskLogin() { selfieScanResult, firstName in
          guard let loginResult = selfieScanResult.faceLoginResult else {
            // Some error occured
            print(selfieScanResult.error)
            return
          }

if loginResult.success == true {
            // Face auth successful
            let customerUUID = loginResult.customerUUID
            let token = loginResult.token
            let interviewId = loginResult.interviewId
          } else {
            if selfieScanResult.spoofAttempt == true {
              // Liveness failed
            } else {
              // User's face not found
            }
          }
        }
```

### Face Login result

Face Login result will have `SelfieScanResult` and `firstName` if there is a name associated to this user, otherwise `firstName` will be `nil`.

The resulting `SelfieScanResult` object will have:

- `faceLoginResult` 
  - `success` 
  - `customerUUID` 
  - `token` 
  - `interviewId` 
  - `interviewToken` 
  - `transactionId` 
- `spoofAttempt` 
- `image` 
- `error`

## Kiosk flow - Create an account for unrecognized users

Kiosk flow will first try to recognize a user by performing a selfie scan, and in case a user is recognized the flow will end and `onKioskFlowCompleted` method of the delegate will be called.

If a user isn't recognized, a new onboarding session is created and the user will be asked to scan their ID, after which a face match comparison will be performed between the front photo ID and Selfie. Afterwards, user approval will be performed and the result will be returned as `KioskFlowResult` via `onKioskFlowCompleted`delegate method.

```undefined
IncdOnboardingManager.shared.startKioskFlow(delegate: self)
```

As the user is going through the steps, these methods of the delegate will be called:

```undefined
  /**
   Called when user dismisses flow.
   */
  func userCancelledSession()

/**
   Called when selfie scan is completed
   */
  func onSelfieScanCompleted(_ result: SelfieScanResult?)

/**
   Called when Kiosk flow is completed
   */
  func onKioskFlowCompleted(_ result: KioskFlowResult)

/**
   Called when ID front scan is completed
   */
  func onIdFrontCompleted(success: Bool)

/**
   Called when ID back scan is completed
   */
  func onIdBackCompleted(success: Bool)

/**
   Called when ID is processed
   */
  func onIdProcessed(success: Bool, ocrData: OmniGetOCRDataResponse?)

/**
   Called when face match is performed
   */
  func onFaceMatchCompleted(success: Bool)

/**
   Called when some error occurred during Kiosk flow
   See IncdFlowError documentation for specific error descriptions
   */
  func onKioskError(_ error: IncdFlowError)
}
```

### Kiosk flow result

The resulting `KioskFlowResult` object will have:

- `success` 
- `customerUUID` 
- `token` 
- `name` 
- `existingUser`

Updated 3 months ago.
