aws-samples / aws-rekognition-liveness-detection

MIT No Attribution
13 stars 12 forks source link

Amazon Rekognition Liveness Detection in Angular

AWS recently launched the Amazon Rekognition Face Liveness feature. This new feature helps deter fraud in facial verification.

Automated Liveness Detection

Steps to run using AWS Amplify

  1. Install Amplify CLI on your local machine

    npm install -g @aws-amplify/cli
  2. Configure Amplify CLI

    amplify configure
  3. Clone this project

    git clone <TODO add path>
  4. Open a new terminal. From the root of the project, run:

    amplify init

    amplify_init

  5. Install Project dependencies. Fire the below command in a terminal from the root of your project foler

   npm install
  1. Add Cognito Authentication. Fire the below command in a terminal from the root of your project folder

    amplify add auth

    amplify_add_auth

  2. Push your changes

    amplify push
  3. Verify if aws-exports.ts file has all the Auth details. We reference properties from this file when generating creadentials to communicate with Amazon Rekognition. amplify_exportjs

  4. Update IAM permissions. Search for IAM role of type 'amplify-{your-app-name}-{environment}-{random-number}-authRole' generated by amplify and add the below inline policy that supports liveness detection features

    {
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "rekognition:StartFaceLivenessSession",
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": "rekognition:CreateFaceLivenessSession",
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": "rekognition:GetFaceLivenessSessionResults",
            "Resource": "*"
        }
    ]
    }

    amplify_auth_role amplify_attach_policy

  5. To run on local machine

    ng serve
  6. To view the hosted application on Amplify

    amplify console
  7. Once you create an account and login you should see the below screen main_screen

  8. Click on Begin Check for automated liveness detection challenge1

  9. Wait for verification. This service gives you a confidence score for face liveness. verification