AWS API Gateway can use the JWT tokens returned by Cognito User Pools to authenticate API calls.
In this step, you will configure an authorizer for your API to use the user pool you created in User Management.
Step 1: Under your newly created API, choose Authorizers
Step 2: Choose Create New Authorizer
Step 3: Enter WildRydes for the Authorizer name
Step 4: Select Cognito for the type
Step 5: In the Region drop-down under Cognito User Pool, select the Region where you created your Cognito user pool in the User Management module
Note: By default the current region should be selected
Step 6: Enter WildRydes in the Cognito User Pool input
Step 7: Enter Authorization for the Token Source
Step 8: Choose Create
Step 1: Open a new browser tab and visit /ride.html under your website’s domain
Step 2: If you are redirected to the sign-in page, sign in with the user you created in the last module. You will be redirected back to /ride.html.
Step 3: Copy the auth token from the notification on the /ride.html.
Step 4: Go back to previous tab where you have just finished creating the Authorizer
Step 5: Click Test at the bottom of the card for the authorizer.
Step 6: Paste the auth token into the Authorization Token field in the popup dialog.
Step 7:Click Test button and verify that the response code is 200 and that you see the claims for your user displayed.