A developer is building a serverless web application. The frontend, hosted on a static website in an Amazon S3 bucket, needs to call a secure backend API hosted on Amazon API Gateway. The API has a resource with `OPTIONS` and `POST` methods. The `POST` method is integrated with an AWS Lambda function using a Lambda custom integration (`AWS` integration type). To secure the API, the developer configures an Amazon Cognito User Pool authorizer and applies it to both the `OPTIONS` and `POST` methods. During testing, the frontend application fails to make requests, and the browser console displays a CORS error during the preflight phase. Additionally, the developer notes that the Lambda function cannot access the Cognito group membership claims of the authenticated user to perform fine-grained authorization. How should the developer resolve these issues?
- AKeep the Cognito User Pool authorizer on both the `OPTIONS` and `POST` methods. Update the authorizer configuration's 'Identity Sources' to include both the `Authorization` header and the `Origin` header to authenticate the preflight request.
- BChange the `POST` method integration to a Lambda proxy integration (`AWS_PROXY`). In the API Gateway integration request settings, define a request mapping template to extract the Cognito group claims from `$context.authorizer.claims` and inject them into the proxy request body.
- CSet the authorization type of the `OPTIONS` method to `NONE`. In the Lambda function's code, add the `Access-Control-Allow-Origin` header to the returned JSON response to satisfy the browser's CORS requirements, and retrieve the group claims from the `event.headers` object.
- Set the authorization type of the `OPTIONS` method to `NONE`. In the request mapping template for the `POST` method integration request, map the `$context.authorizer.claims['cognito:groups']` context variable to a JSON property in the payload sent to the Lambda function.Answer