Serverless Lambda Custom Authorize

Using Sam templates creating an API and custom token authorize takes less time to build and deploy. Sam init creates the boiler plate code to start. Create a java script handler for the authorization and refer the authorize in API.

Authorizer checks token for allow/deny

After adding the custom validation add the required mapping to template.json file for deployment

API Definition
AuthFunction

API Definition

Test the API endpoint using post man or any other rest client with out the authorization token the request will fail with unauthorized message like

Source code uploaded to Github

--

--