Custom Authorizer

aws

#1

I have this function which I want to handle authorization:
module.exports.authorizer = (event, context, callback) => {
callback(null, { message: ‘Successful authenticated’, event });
};
In the protected function I specified the function’s asn to be the authorizer and on deploy it is configured to be the authorizer of that function.

But when I call the function I get a 500 errror


#2

Custom Authorizers (recently renamed to Lambda Authorizers) need to return an IAM policy and not a simple message. More can be found here:

https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html