简体   繁体   中英

How do you access an AWS Lambda with credentials using API Gateway?

I'm not clear on how to send credentials and IAM access to an API gateway. This seems clear: 在此处输入图片说明

There is the tutorial on AWS but this is not the way I wanted to access my API. API Gateway example As most would know, you put your AWS Key and Secret key in a configuration file that lives in .AWS on the userspace of the user but if you are using a website, for example, you won't have that. Is the idea that anytime a user access the API that you put that user in an anonymous group that has access to the .credentials file?

You are describing IAM authentication for API Gateways . For your of your web app to generate IAM credentials I would recommend using a Cognito Identity Pool Authenticated Role . The Cognito Identity Pool Authenticated Role Exchanges a JWT for the AWS IAM credentialsthat are used in API calls. Your users will first authenticate against the identity pool. The identity pool even allows for unauthenticated users that are using your registered app to generate credentials with permissions which you specify. This guide will show you how to generate these credentials in your code.

Alternatively you can use API Gateway Identity Pool Authorizer or API Gateway Lambda Authorizer to secure your API.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM