Alice Onboarding is a complete solution created for onboarding, but flexible enough to enable other use cases through the same API and SDKs without any additional complexity.

Here you will find how to easily build a login use case with Alice Onboarding. In a typical login use case, a user registers itself with a selfie. After a while, the user authenticates with a new selfie and is accepted or rejected based on the facial resemblance to the registration selfie.

Login flow

The login process can be divided into 3 steps:

  1. Enrollment: the user registers with a selfie.

  2. Authorization: your backend reviews the enrollment and approves/denies the user to perform logins.

  3. Authentication: the user authenticates against the enrollment selfie.

Alice Login flow

1. Enrollment

1.1 User creation

Create a user from your backend in the Alice Onboarding API.

curl --request POST \
--url https://apis.alicebiometrics.com/onboarding/user \
--header 'Authorization: Bearer <BACKEND_TOKEN>' \
--header 'Content-Type: multipart/form-data' \
--form email=example@example.com
from alice import Config, Onboarding

config = Config(api_key=api_key)
onboarding = Onboarding.from_config(config)
user_id =  onboarding.create_user().unwrap_or_throw()

1.2 Add selfie

From the client-side, the user captures and sends a selfie with the Alice Onboarding Client SDK.

curl --request POST \
--url https://apis.alicebiometrics.com/onboarding/user/selfie \
--header 'Authorization: Bearer <USER_TOKEN>' \
--header 'Content-Type: multipart/form-data' \
--form video=@/path/to/selfie/video.mp4
let userToken = "<ADD-YOUR-USER-TOKEN-HERE>"

let config = OnboardingConfig.builder()

let onboarding = Onboarding(self, config: config)
onboarding.run { result in
    switch result {
    case let .success(userStatus):
        print("userStatus: \(String(describing: userStatus))")
    case let .failure(error):
        print("failure: \(error.localizedDescription)")
    case .cancel:
        print("User has cancelled the onboarding")
val userToken = "<ADD-YOUR-USER-TOKEN-HERE>"

val config = OnboardingConfig.builder()

val onboarding = Onboarding(this, config: config)


override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)
        if (requestCode == ONBOARDING_REQUEST_CODE) {
            if (resultCode == Activity.RESULT_OK) {
                val userInfo = data!!.getStringExtra("userStatus")
        } else if (resultCode == Activity.RESULT_CANCELED) {

    "stages": [
       {"stage": "addSelfie"},

    onSuccess={(userStatusJson) => console.log("onSuccess:" + userStatusJson) }
    onFailure={(failureJson) => console.log("onFailure:" + failureJson) }
    onCancel={(value) => console.log("onCancel:" + value) }
let userToken = "<ADD-YOUR-USER-TOKEN-HERE>"
let config = new aliceonboarding.OnboardingConfig()

function onSuccess(userInfo) {console.log("onSuccess: " + userInfo)}
function onFailure(error) {console.log("onFailure: " + error)}
function onCancel() { console.log("onCancel")}

new aliceonboarding.Onboarding("alice-onboarding-mount", config).run(onSuccess, onFailure, onCancel);

1.3 Report

From your backend, ask for the Report to check the enrollment selfie.

curl --request GET \
--url https://apis.alicebiometrics.com/onboarding/user/report \
--header 'Authorization: Bearer <BACKEND_TOKEN_WITH_USER_ID>' \
--header 'Content-Type: multipart/form-data' \
--header 'Alice-Report-Version: <0,1>'
report = onboarding.create_report(
    report_version=<ReportVersion.V0, ReportVersion.V1>

To approve the enrollment selfie, you will have to check its liveness score. Please check the following snippets depending on which report version you are asking for.

 "created_at": "2021-03-02T09:32:57.344383",
 "document_reports": {},
 "selfie_reports": {},
 "user_summary": {
    "authorized": false,
    "created_at": "2021-03-02T09:13:08",
    "documents": {},
    "fields": {},
    "selfie": {
       "created_at": "2021-03-02T09:14:38",
       "face_bounding_box": {},
       "liveness": {
          "score": 0.16740356308011584
       "media_avatar_id": "dd1482a0-595c-4a84-8514-d850b39c43b1.jpeg",
       "media_id": "104c030c-9381-402f-aad2-e67b99c71598.webm",
       "media_selfie_id": "b5f03597-5ff1-482a-b439-588a01068aac.png",
       "voided": false
    "user_id": "deb78277-af90-47b6-b3b7-461129a819bf"
 "version": 0
 "created_at": "2021-07-20T14:13:12.295516",
 "documents": [],
 "events": [],
 "id": "22e50a8c-1ff7-4e97-87b2-59b042a2e3d2",
 "selfies": [],
 "summary": {
   "checks": [],
   "devices": [],
   "external_user_data": {},
   "face_liveness": 16.740356308011584,
   "face_matching": [],
   "user_data": []
 "user_id": "deb78277-af90-47b6-b3b7-461129a819bf",
 "version": 1

Reference liveness thresholds:

  • Report V0: 0.5

  • Report V1: 50

If the liveness score is below the recommended threshold, you should void the user’s selfie and ask the user to start the enrollment again.

curl --request PATCH \
--url https://apis.alicebiometrics.com/onboarding/user/selfie \
--header 'Authorization: Bearer <BACKEND_TOKEN_WITH_USER_ID>'

2. Authorization

An authorized user is allowed to use some additional features (e.g authenticate with the face). This is a must in order to enable the user to perform logins.

curl --request POST \
--url https://apis.alicebiometrics.com/onboarding/user/authorize \
--header 'Authorization: Bearer <BACKEND_TOKEN_WITH_USER_ID>'

3. Authentication (Login)

After a while, you may want to authenticate a previously registered user against a given media to verify its identity.

3.1 User authentication

In the same way as with the enrollment, from the client-side, the user captures and sends a selfie with the Alice Onboarding Client SDK. The authentication endpoint returns an authentication_id that you should send to your backend.

curl --request POST \
--url https://apis.alicebiometrics.com/onboarding/user/authenticate \
--header 'Authorization: Bearer <USER_TOKEN>' \
--header 'Content-Type: multipart/form-data' \
--form video=@/path/to/selfie/video.mp4
Use the respective Authenticate command detailed in the
"MOBILE CLIENT-SIDE SDKS > Onboarding Commands" section
Use the Authenticate command detailed in the
"WEB CLIENT-SIDE SDKS > Web Onboarding Commands" section

3.1 Get authentication

In your backend, use the authentication_id returned in the previous step to get the authentication result.

curl --request GET \
--url https://apis.alicebiometrics.com/onboarding/user/authentication/<AUTHENTICATION_ID> \
--header 'Authorization: Bearer <BACKEND_TOKEN_WITH_USER_ID>' \
--header 'Content-Type: multipart/form-data'
authentication = onboarding.get_authentication(

To approve the user’s login (authentication) selfie, you will have to check 2 scores:

  1. Liveness result (recommended threshold 0.5)

  2. Face match result (recommended threshold 0.7)

GET /user/authentication/<authentication_id> response example
 "authentication": {
     "created_at": "2020-10-27T09:59:45",
     "liveness_result": {
       "score": 0.33450181061727124
     "match_result": {
       "normalized": 0.7498937406176167,
       "score": 0.84993624437057
     "media_id": "xxxxxxxxxxxxxxxx-yyyyyy=.png",
     "user_id": "xxxxxxx-5yyyyy"

If the liveness or face matching scores are below the recommended thresholds, you should deny the user’s login and ask him/her to repeat the login.