A company is developing a fitness tracking mobile application. The application needs to access a REST API hosted on Amazon API Gateway to retrieve user workout histories. The development team wants to implement an authorization mechanism that allows users to authenticate using their existing email and password credentials, validates their JSON Web Tokens (JWTs) directly at the API Gateway level without invoking a custom Lambda function, and extracts user identity claims for backend processing. Which configuration should the developer implement to meet these requirements with the lowest latency and operational overhead?
- Configure a built-in Amazon Cognito User Pools authorizer on the API Gateway REST API.Answer
- BConfigure an Amazon Cognito Identity Pools authorizer directly on the API Gateway REST API.
- CImplement a custom Lambda authorizer that fetches public keys from the Cognito User Pool to validate the JWT.
- DConfigure API Gateway with Lambda Proxy integration to inspect and validate the JWT inside the backend integration function.
Answer
Configure a built-in Amazon Cognito User Pools authorizer on the API Gateway REST API.
The correct configuration is to use the built-in Amazon Cognito User Pools authorizer. This option integrates directly with the user pool to authenticate and validate the signature of incoming JWT tokens without invoking custom Lambda code. Once validated, user claims are automatically populated into the request context and sent to the backend integration, providing a highly optimized, low-overhead solution.
Step-by-Step Solution
Key Concept
API Gateway Cognito User Pools Authorizer