Перейти к основному содержимому
iOS SDK Lite

Open the Human Token capture natively in your iOS app using only the webAppToken of the process.

Markdown

The SDK Lite is the Unico iOS SDK for the Human Token. It runs the capture in the Unico web experience embedded in the SDK and enters only with the webAppToken of a process created by your backend. The app holds no credentials: everything it needs comes from the token.

SDK version

Available from iOS SDK 3.6.0 onwards, through Swift Package Manager.

How it works​

Prerequisites​

RequirementVersion / value
Minimum iOS13
Xcode16.0+
Dependency managerSwift Package Manager (the SDK Lite is not published on CocoaPods)
Required permissionsNSCameraUsageDescription
  • A backend that creates the process with Create Process and hands the webAppToken from the response to the app.
  • Token entry enabled for your account by Unico in the target environment.

Step 1: Install the SDK Lite​

Add the package https://github.com/acesso-io/unico-check-ios and select the unicocheck-ios-spm-lite product.

In Xcode, open File > Add Package Dependencies, enter the package URL and select the unicocheck-ios-spm-lite product.

The product ships the AcessoBio module (import AcessoBio).

Step 2: Get the webAppToken from your backend​

Your backend creates the process with Create Process and sends the app the webAppToken field of the response. The app passes it to the SDK as is. The token and link fields of the same response are for other uses: passed to the SDK, the token is rejected with error 73304.

  • One process per journey. Create a new process, and a new token, every time the user starts the capture.
  • Short-lived. The webAppToken is valid for 5 minutes. Create it right before opening the capture.
  • Same environment. The process and the SDK must use the same environment (UAT or PROD).
предупреждение

Never embed credentials, access keys or a fixed token in the app. The webAppToken is created by your backend for each journey.

Step 3: Open the capture​

Get the webAppToken from your backend, build the SDK with AcessoBioManager, set the environment and call prepareAndOpenSelfieCamera(_:webAppToken:) with it. The call prepares the SDK and opens the capture at once.

import UIKit
import AcessoBio

final class CaptureViewController: UIViewController, AcessoBioManagerDelegate, AcessoBioSelfieDelegate {

func startCapture() {
Task {
// Your backend calls Create Process and returns the `webAppToken` field of the response
let webAppToken = try await yourBackend.createHumanTokenProcess()

let camera = AcessoBioManager(viewController: self, delegate: self)
.setEnvironment(.PROD) // Same environment used by your backend to create the process
.build()
camera?.prepareAndOpenSelfieCamera(self, webAppToken: webAppToken) // build() is imported into Swift as an optional
}
}

// Journey result. Required.
func onSuccess(_ successResult: SuccessResult) {
// Journey completed: send successResult.processId to your backend
}

// Required by the protocol. The journey result arrives in onSuccess(_:).
func onSuccessSelfie(_ result: SelfieResult) { }

func onErrorSelfie(_ errorBio: ErrorBio) {
// 73305 (expired token): create a new process and try again
}

// AcessoBioManagerDelegate
func onErrorAcessoBioManager(_ error: ErrorBio) { }
func onUserClosedCameraManually() { }
func onSystemClosedCameraTimeoutSession() { }
func onSystemChangedTypeCameraTimeoutFaceInference() { }
}
onSuccess is required

AcessoBioSelfieDelegate declares onSuccess(_:) as optional, so the compiler does not check it. Without it, the capture does not open and onErrorSelfie receives error 74001. Copy the signature exactly as shown.

  • Callbacks arrive on the main queue.
  • The capture does not run on the simulator (error 73006).
  • onSuccess signals that the journey ended, not that the user was approved. Always read the result with Get Process or a webhook.

Environment​

The capture uses the environment set by setEnvironment on the builder. Use the environment where the process was created.

Error codes​

CodeWhenWhat to do
73203The webAppToken is empty or contains only spacesPass the webAppToken returned by your backend
73006Running on the simulatorTest on a physical device
73302Authentication failed for another reason, such as network or an unexpected responseRetry; if it persists, contact support
73303Unico refused to prepare the capture, including when token entry is not enabled for your account in the environmentCheck with Unico that token entry is enabled in that environment
73304The token was rejected (invalid signature or content), including when the token field is passed instead of the webAppTokenPass the webAppToken of a valid process
73305The token expiredCreate a new process and call prepareAndOpenSelfieCamera again with the new webAppToken
73701The call is not available in the SDK LiteUse prepareAndOpenSelfieCamera(_:webAppToken:)
74001The delegate does not implement onSuccess(_:)Implement onSuccess(_:) with the exact signature

What's next​

  • Fetch the result with Get Process and store data.humanToken.value with the user record.
  • Can't use the SDK Lite? Open the journey link instead, as described in iOS.
  • Check the versions that include the lite edition in the SDK Lite Release Notes.
  • Integrating on Android? See Android SDK Lite.