Creating the API
Login to your AWS Console and search for API Gateway in the search bar and select it in the menu.
Look for the REST API section and click Build.
Select New API.
In the Actions dropdown menu, click on Create a new Resource.
Give the resource a name like, signup and use signup for the path.
Click on Create Resource to complete the process.
This will allow us to create our API endpoints under the auth resource path once we define them, which you’ll see what I mean later.
Click on the resource that was created.
Select POST in the dropdown under the resource and click the Check icon.
On the right side, make sure the Lambda Function is selected for the Integration type and the Lambda Region is the region for your Lambda.
For the Lambda Function, type in the name of the lambda that is used for creating accounts.
For the Permission alert, select “OK.” to automatically apply the correct permissions to our API to call the lambda.
Now we have our first endpoint for our API endpoint.
To test this, click on the Actions dropdown and deploy the API.
Select [New Stage] for the Deployment stage.
Testing
Now we can use the Invoke URL provided to us to test.
Open the level blueprint and call Event Begin Play if you do not have it.
Select POST for the method since the endpoint we created is a POST request.
If we take a look at the Resources tab, the endpoint we want to use is /signup. So, in the blueprint node, we need to add it at the end of the URL.
For the params, create an empty map. For the headers, set the Content-Type to application/json to indicate that we want to send in a JSON object with the request.
For the Body, we need to pass in a JSON object with a username and password value. To do that, call the Append node for strings.
For the first slot, put the open curly bracket. For the 2nd slot, do open quote, username, close quote, colon, open quote, a valid email you can use to test, close quotes, then a comma.
Set it as the Body of the request, then add the On Complete callback.
Click and hold on it, then drag on an empty spot. Select Add Event, then Add Custom Event.
Compile, save, and launch the app.
Creating the Confirmation Endpoint
Now, let’s finish creating the API.
Now click on Confirm Resource and create a new method.
Select POST from the dropdown menu under Confirm Resource and click on the check icon.
This time, we want to use the ConfirmAccount lambda.
Click “Save” and add the permission
Creating the SignIn Endpoint
This time, we want to use the lambda for signing in.
Deploy
That’s all the endpoint we’ll need. Now we just need to deploy it.
That’s all for this tutorial.