Face Authentication
Explains how to integrate a face authentication
To perform a face authentication it is required to have already an "Identification" and its verification ID. The process consist in a liveness check of the user and a final check to verify the match with the identification.

Implementation

  • Make your class conform to AuthenteqFaceAuthenticationDelegate protocol
  • Use your client keys to create a UIViewController from Authenteq SDK
  • Present returned UIViewController modally
  • Handle result in your delegate implementation

Example to Start a Face Authentication

Please update the below code with your Client ID and Client Secret from your Customer Dashboard.
We suggest to use the token authentication in production environment.
We suggest to app the following code to the relevant Storyboard or ViewController.
Swift
Objective-C
1
import AuthenteqFlow
2
3
class ExampleViewController: UIViewController {
4
5
func faceAuthentication() {
6
let faceAuthenticationParams = FaceAuthenticationParams(
7
clientId: "< YOUR CLIENT ID >",
8
clientSecret: "< YOUR CLIENT SECRET >",
9
verificationId: verificationId
10
)
11
let viewController = AuthenteqFlow.instance.faceAuthenticationViewController(
12
with: faceAuthenticationParams,
13
delegate: self
14
)
15
viewController.modalPresentationStyle = .fullScreen
16
present(viewController, animated: true)
17
}
18
}
19
20
extension ExampleViewController: AuthenteqFaceAuthenticationDelegate {
21
22
func authenteqDidFinishFaceAuthentication(with code: String) {
23
presentedViewController?.dismiss(animated: true)
24
// Check face authentication result with the CODE provided
25
}
26
27
func authenteqDidFailFaceAuthentication(with error: AuthenteqFlowError) {
28
// Handle error
29
presentedViewController?.dismiss(animated: true)
30
}
31
}
Copied!
1
@import AuthenteqFlow;
2
3
@interface ExampleViewController: UIViewController <AuthenteqFaceAuthenticationDelegate>
4
@end
5
6
@implementation ExampleViewController
7
8
- (void)faceAuthentication {
9
FaceAuthenticationParams *params =
10
[[FaceAuthenticationParams alloc] initWithClientId:@"<YOUR CLIENT ID>"
11
clientSecret:@"<YOUR CLIENT SECRET>"
12
verificationId:_verificationId];
13
14
UIViewController *viewController =
15
[[AuthenteqFlow instance] faceAuthenticationViewControllerWith:params
16
delegate:self];
17
18
viewController.modalPresentationStyle = UIModalPresentationFullScreen;
19
[self presentViewController:viewController animated:true completion:nil];
20
}
21
22
#pragma MARK - AuthenteqFaceAuthenticationDelegate
23
24
- (void)authenteqDidFinishFaceAuthenticationWith:(nonnull NSString *)code {
25
[self.presentedViewController dismissViewControllerAnimated:true completion:nil];
26
NSLog(@"Did finish face authentication with code:\n%@", code);
27
// Check face authentication result with the CODE provided
28
}
29
30
- (void)authenteqDidFailFaceAuthenticationWith:(enum AuthenteqFlowError)error {
31
// Handle error
32
[self.presentedViewController dismissViewControllerAnimated:true completion:nil];
33
NSLog(@"Did finish face authentication with error: %ld", (long) error);
34
}
35
36
@end
Copied!
Authentication Token can be obtained with face authentication API and then specified with the FaceAuthenticationParams as the following code:
Swift
Objective-C
1
let faceAuthenticationParams = FaceAuthenticationParams(
2
clientId: "< YOUR CLIENT ID >",
3
token: "< TOKEN >",
4
verificationId: verificationId
5
)
6
let viewController = AuthenteqFlow.instance.faceAuthenticationViewController(
7
with: faceAuthenticationParams,
8
delegate: self
9
)
10
present(viewController, animated: true)
Copied!
1
FaceAuthenticationParams *params =
2
[[FaceAuthenticationParams alloc] initWithClientId:@"< YOUR CLIENT ID >"
3
token:@"< TOKEN >"
4
verificationId:_verificationId];
5
6
UIViewController *viewController =
7
[[AuthenteqFlow instance] faceAuthenticationViewControllerWith:params
8
delegate:self];
9
10
[self presentViewController:viewController animated:true completion:nil];
Copied!

Get Face Authentication Result

With the code obtained from authenteqDidFinishFaceAuthentication it is possible to get the face authentication result using the following API:
get
https://api.app.authenteq.com
/mobile-sdk/face-authentication-result
Obtain the result of a face authentication
When successful the response will contain a single boolean property named success:
1
{
2
"success": true
3
}
Copied!