You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide the responses shown after each of the following prompts.
27
27
```
28
28
? Enter a name for the environment
29
-
`dev`
29
+
`dev`
30
30
? Choose your default editor:
31
-
`Android Studio`
31
+
`Android Studio`
32
32
? Where is your Res directory:
33
-
`app/src/main/res`
33
+
`app/src/main/res`
34
34
? Select the authentication method you want to use:
35
-
`AWS profile`
35
+
`AWS profile`
36
36
? Please choose the profile you want to use
37
-
`default`
37
+
`default`
38
38
```
39
39
Wait until provisioning is finished. Upon successfully running `amplify init`, you will see a configuration file created in `./app/src/main/res/raw/` called `amplifyconfiguration.json`. This file will be bundled into your application so that the Amplify libraries know how to reach your provisioned backend resources at runtime.
40
40
@@ -65,12 +65,11 @@ Provide the responses shown after each of the following prompts.
65
65
? Select the social providers you want to configure for your user pool:
66
66
`<hit enter>`
67
67
```
68
-
4. Update the `AndroidManifest.xml` file in your project according to the steps [here](https://docs.amplify.aws/lib/auth/signin_web_ui/q/platform/android/#update-androidmanifestxml).
69
-
5. Once finished, run `amplify push` to publish your changes.
68
+
4. Once finished, run `amplify push` to publish your changes.
70
69
Upon completion, `amplifyconfiguration.json` should be updated to reference these provisioned backend resources.
71
-
6. Follow the steps below to create an inline policy to enable authenticated app users to access Rekognition, which powers the FaceLivenessDetector.
70
+
5. Follow the steps below to create an inline policy to enable authenticated app users to access Rekognition, which powers the FaceLivenessDetector.
72
71
1. Go to AWS IAM console, then Roles
73
-
2. Select the newly created `unauthRole` for the project (`amplify-<project_name>-<env_name>-<id>-authRole`).
72
+
2. Select the newly created `authRole` for the project (`amplify-<project_name>-<env_name>-<id>-authRole`).
74
73
3. Choose **Add Permissions**, then select **Create Inline Policy**, then choose **JSON** and paste the following:
75
74
76
75
```
@@ -90,8 +89,117 @@ Provide the responses shown after each of the following prompts.
90
89
5. Name the policy
91
90
6. Choose **Create Policy**
92
91
93
-
7. Set up a backend to create the liveness session and retrieve the liveness session results. The liveness sample app is set up to use API Gateway endpoints for creating and retrieving the liveness session. Follow the [Amazon Rekognition Liveness guide](https://docs.aws.amazon.com/rekognition/latest/dg/face-liveness-programming-api.html) to set up your backend and edit the [LivenessSampleBackend class](https://github.com/aws-amplify/amplify-ui-android/blob/main/samples/liveness/app/src/main/java/com/amplifyframework/ui/sample/liveness/LivenessSampleBackend.kt) in your project as necessary to work with your backend.
92
+
### Provision Backend API
93
+
Set up a backend API using [Amplify API category](https://docs.amplify.aws/lib/restapi/getting-started/q/platform/android/) to create the liveness session and retrieve the liveness session results. The liveness sample app is set up to use API Gateway endpoints for creating and retrieving the liveness session.
94
94
95
+
1. Run the following command to create a new REST API:
96
+
```
97
+
amplify add api
98
+
```
99
+
Provide the responses shown after each of the following prompts.
100
+
```
101
+
? Please select from one of the below mentioned services
102
+
`REST`
103
+
? Would you like to add a new path to an existing REST API:
104
+
`N`
105
+
? Provide a friendly name for your resource to be used as a label for this category in the project:
106
+
`livenessBackendAPI`
107
+
? Provide a path (e.g., /book/{isbn}):
108
+
`/liveness/create`
109
+
? Choose a Lambda source
110
+
`Create a new Lambda function`
111
+
? Provide an AWS Lambda function name:
112
+
`createSession`
113
+
? Choose the runtime that you want to use:
114
+
`NodeJS`
115
+
? Choose the function template that you want to use:
116
+
`Serverless ExpressJS function (Integration with API Gateway)`
117
+
? Do you want to configure advanced settings?
118
+
`N`
119
+
? Do you want to edit the local lambda function now?
120
+
`Y`
121
+
? Restrict API access?
122
+
`Y`
123
+
? Who should have access?
124
+
`N`
125
+
? Do you want to configure advanced settings?
126
+
`Authenticated users only`
127
+
? What permissions do you want to grant to Authenticated users?
128
+
`create,read,update`
129
+
? Do you want to add another path?
130
+
`Y`
131
+
? Provide a path (e.g., /book/{isbn}):
132
+
`/liveness/{sessionId}`
133
+
? Choose a Lambda source
134
+
`Create a new Lambda function`
135
+
? Provide an AWS Lambda function name:
136
+
`getResults`
137
+
? Choose the runtime that you want to use:
138
+
`NodeJS`
139
+
? Choose the function template that you want to use:
140
+
`Serverless ExpressJS function (Integration with API Gateway)`
141
+
? Do you want to configure advanced settings?
142
+
`N`
143
+
? Do you want to edit the local lambda function now?
144
+
`Y`
145
+
? Restrict API access?
146
+
`Y`
147
+
? Who should have access?
148
+
`Authenticated users only`
149
+
? What permissions do you want to grant to Authenticated users?
150
+
`create,read,update`
151
+
? Do you want to add another path?
152
+
`N`
153
+
```
154
+
2. Copy the code for from amplify-ui-android/samples/backend-lambda-functions to the path provided
155
+
3. Once finished, run `amplify push` to publish your changes.
156
+
4. Follow the steps below to create an inline policy to enable the **createSession** lambda function to access Rekognition.
157
+
1. Go to AWS Lambda console -> **CreateSession** -> Configuration -> Permissions
158
+
2. Click the role name under 'Execution role'
159
+
3. Choose **Add Permissions**, then select **Create Inline Policy**, then choose **JSON** and paste the following:
0 commit comments