#✅ - API Gateway Lambda Authorizer

8 messages · Page 1 of 1 (latest)

lusty rain
#

I'd like to configure my REST API to invoke a custom lambda authorizer. Is there a way to configure this with the amplify cli, or will I need to override the rest api and add it with the cdk functions? Also, is there a way to configure this on a per-endpoint basis.

I want external services to be able to access some of these endpoints via a bearer token, while also letting my own users and services access other endpoints.

#

I can see the permissions field in the cli-inputs.json for my rest api. Is it possible to use this file somehow?

shrewd quiver
#

I'm also interested in this! It might be possible with overrides 🤔 https://docs.amplify.aws/cli/restapi/override/

With overrides you can at least apply API Key auth to specific endpoints: https://github.com/aws-amplify/amplify-category-api/issues/438#issuecomment-1484733403

I don't know if there is a better way, but I then created API Keys and Usage Plans in the console, and attached them to my stage.

What I haven't yet figured out is how could I:

  • Automatically create an API Key with a Usage plan (in the overrides)
  • Add that API Key to the REST Api of my current Amplify environment
    or even better: Use that API Key for the single method I have created onto my REST Api with CLI
GitHub

So, I have used amplify api add and now have GraphQL and REST API in my project, but the auth for my REST API is using Cognito. How can I change that? I would like to use API Key authentication for...

lusty rain
#

Nice to see other people also want something like this. Frustrating that it hasn't been included yet after such a long time. Especially since we can create lambda authorizers for AppSync through the cli.

shrewd quiver
#

For now I guess I'll do any additional authorization logic I need in the invoked Lambda..

#

I created new API and lambda just for external integrations, so that should not be that much trouble 🤔

mellow phoenixBOT
#

✅ - API Gateway Lambda Authorizer

#

Answer selected!


With overrides you can at least apply API Key auth to  specific endpoints:  https://github.com/aws-amplify/amplify-category-api/issues/438#issuecomment-1484733403

I don't know if there is a better way, but I then created API Keys and Usage Plans in the console, and attached them to my stage.

What I haven't yet figured out is how could I:
- Automatically create an API Key with a Usage plan (in the overrides)
- Add that API Key to the REST Api of my current Amplify environment
    or even better: Use that API Key for the single method I have created onto my REST Api with CLI```
Kudos to @shrewd quiver!
#1105355624943992874 message