Install serverless framework if you haven't
npm install -g serverlessCreate a free developer account with Auth0 and setup an application. (A new tenant environment if u need to)
npm installThis file will contain your Auth0 public certificate, used to verify tokens.
Create a secret.pem file in the root folder of this project. Simply paste your public certificate in there from Auth0.
We need to deploy the stack in order to consume the private/public testing endpoints.
sls deploy -vTo make sure everything works, send a POST request (using curl, Postman etc.) to your private endpoint.
You can grab a test token from Auth0. Make sure to provide your token in the headers like so:
"Authorization": "Bearer YOUR_TOKEN"
And should be golden!!! 😎
To use the authorizer reference it on your existing aws lambda function or public AWS API gateway.