aws-amplify / amplify-ui-swift-liveness

This repository offers a UI component for Amazon Rekognition Face Liveness, enabling developers to ensure that only authentic users, and not bad actors using spoofs, can access their services.
https://ui.docs.amplify.aws/swift/connected-components/liveness
Apache License 2.0
9 stars 20 forks source link

Not able to start FaceLiveness with Validation error #73

Closed Izainab22 closed 10 months ago

Izainab22 commented 11 months ago

Hi,

I'm using the same app you've uploaded, and I did all the backend configurations. For creating the sessionId I'm using my own .Net API and I'm calling it in createSession() function. But I'm not able the start the faceLiveness.

Create Liveness Session Button will call my API and pass the sessionId to FaceLivenessDetectorView, and it's opening the camera but once the recording is started before getting the Oval I'm getting Validation error and the camera still open without doing any thing.

These are the errors am getting in the console:

Screenshot 2023-11-09 at 8 44 38 AM

phantumcode commented 10 months ago

can you verify if you have the appropriate IAM policy? you should have permission for each of the following rekognition actions:

auth or unauth role of client/app user to start the liveness session: "rekognition:StartFaceLivenessSession"

backend service to create and get the liveness results: "rekognition: CreateFaceLivenessSession" "rekognition:GetFaceLivenessSessionResults"

Can you provide any sample code or sample app?

phantumcode commented 10 months ago

@Izainab22 Can you also provide what device model and iOS version you're seeing this error in?

Izainab22 commented 10 months ago

I'm able to start the liveness in the demo app you provided now, I was configuring User Pool Group and I didn't give a permission for it. Once I granted the permission it worked.

But I'm using the same code in my app with the same configurations I did in with the demo app, and I'm facing the same issue but the difference is there's no failure and no thing begin printed in the console!

Here is more details:

I'm testing on iPhone 14 Pro Max and iPhone XS - both are iOS 16.6.

I'm using UIKit as a default language in my app. I can open the view and see the camera with the recording and close icons but it is sticking on recording without showing me the oval to detect the face and without any error printed in the console!

These are my CLI configurations:

  1. Amplify Init:

WfR9K

  1. Amplify add auth:

3kjGm

In AWS Console I've granted the below permission to my anauth, auth roles and my user pool group:

{
"Effect": "Allow",
"Action": "rekognition:StartFaceLivenessSession",
"Resource": "*"
}

I granted only this access because I've developed .Net API's for creating the session and getting the result. And I'm calling these API's in my iOS app.

My code:

  1. My UIKit Controller:

kwGvQ

  1. My SwiftUI View:

JCly1

I've been blocked at this stage for almost a week... Your help will be much much appreciated!

phantumcode commented 10 months ago

@Izainab22 Could you provide a sample app that replicates your app running into the same issue to help with debugging/troubleshooting?

Izainab22 commented 10 months ago

@phantumcode Thanks for your support! It finally worked, the issue was with 'DBDebugToolkit' cocoapod. I was using it in my app and it seems the AWS API is not being called for security reasons, once I comment it out it worked!