Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple authorizer types for one endpoint in serverless

I’m doing some experimenting with serverless and authorizers for my API. I have a usecase where I have two different apps, one iOS and one Angular. The iOS app uses developer authentication with federated identities since it authenticates with a third party api, and the Angular app uses Cognito Userpools for authentication.

So i can specify a function with a User Pool authorizer and that works fine, and for my developer authentication users i’m using AWS_IAM authorizer and that works fine too.

But now i want my developer authenticated identities and my user pool users to be able to access the same api gateway endpoint. So how can I use two different types of authorizers for one endpoint?

Anyone with some experience in this that could point me in the right direction?

like image 519
okarlsson Avatar asked Jan 06 '18 12:01

okarlsson


People also ask

Can API Gateway have multiple authorizers?

An API can have multiple custom authorizers and each method within your API can use a different authorizer. For example, the POST method for the /login resource can use a different authorizer than the GET method for the /pets resource.

Which types of custom authorizers are supported by API gateway?

The API gateway acts as a reverse proxy that accepts all API (Application Programming Interface) calls, aggregates the various services needed to execute them, and returns appropriate results. There are two types of custom authorizers. Tokens and Requests. The token authorizer is the simplest.


1 Answers

I actually had the same problem. I ended up building a custom authorizer for this.

On the authorizer you can always do both validations.

like image 80
dege Avatar answered Oct 22 '22 10:10

dege