Protecting AWS API Gateway From 3rd Party Only
0
Hello,
I need to control access to my REST API Gateway in the following manner:
- When called from my own web app (SPA hosted on S3/CloudFront at a specific Route53 domain) it should go through only after validating the calling user in terms of authentication and authorization through an OAuth2 JWT token.
- When a 3rd party calls (any other domain/machine) the above should also happen, but only after validating that a specific API Token has been issued to the caller.
What technologies should I be using to achieve the above please?
1 Answers
0
API Gateway supports only a single authorization method per route. If need something which is more complex than what API Gateway supports (Cognito or IAM), you will need to use a Lambda authorizer. In the authorizer you can check the source (based on maybe some secret header that you pass from the client) and if it is not your client, you check for the other token.
- So you mean I cannot use Cognito + API token to protect a single route?
- Is it actually safe to pass a fixed API token from an SPA client to the Gateway?
You can use both Cognito and API keys, however, if you specify that API keys are required, they will be required for everyone.
Not really, but it is not very different than passing an API key.
Relevant questions
CORS Access-Control-Allow-Origin not displayed in API Gateway console
asked a year agoI am having an issue in API Gateway that says " No integration defined for method" when I attempt to deploy
asked 2 months agoAPI Gateway, Lambda and CORS
asked a year agoDeploy Lambda Function and API Gateway REST
asked 3 months agoAPI Gateway Timeouts from Lambda
asked 3 years agoI'm getting {"message":"Forbidden"} when trying to access my lambda from custom domain in api Gateway
asked 5 months agoControl access for invoking Rest API in API Gateway
Accepted Answerasked 2 years agoAPI Gateway - Gateway response - HTTP API
Accepted Answerasked a year agoProtecting AWS API Gateway From 3rd Party Only
asked 2 months agoREST API sent to API Gateway, how to access POST body data (application/json type) from within lambda application?
Accepted Answerasked 2 years ago