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 :--
https://github.com/awsmasterchef/cogn...
#aws #awslambda #apigateway