Lambda Authorizer with AWS Cognito in 10 Mins by awsmasterchef
ฝัง
- เผยแพร่เมื่อ 21 ส.ค. 2024
- In this video we have seen how we can use lambda authorizer with API Gateway
here is AWS lambda code
def lambda_handler(event, context):
print(event)
verify token
if event['authorizationToken'] == 'allow':
auth = 'Allow'
else:
auth = 'Deny'
#3 - Construct and return the response
authResponse = { "principalId": "abc123",
"policyDocument": { "Version": "2012-10-17", "Statement": [{"Action": "execute-api:Invoke",
"Resource": ["arn:aws:execute-api:region:accountid:y9owlxfcl3/*/*"], "Effect": auth}] }}
return authResponse
AWS Cognito token verification code :--
github.com/aws...
#aws #awslambda #apigateway