Skip to content

A short and easy boilerplate showcasing JWT auth with Nodejs, the Serverless framework, MongoDB and AWS Lambda.

Notifications You must be signed in to change notification settings

adnanrahic/a-crash-course-on-serverless-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A crash course on Serverless Authentication/Authorization

A short and easy boilerplate showcasing JWT auth with Nodejs, the Serverless framework, MongoDB and AWS Lambda.

  • The auth folder has a VerifyToken.js file which is the base of the authorizer function.
  • The VerifyToken.auth method is added to the authorizer field in the serverless.yml for API Gateway routes you wish to keep private. See the me function. AuthHandler.me uses event.requestContext.authorizer.principalId to access the userId of the user accessing the resource if the JWT is valid. Otherwise returns 'Unauthorized'.

Note: The concept of middlewares can be applied to this for understanding it easily.

About

A short and easy boilerplate showcasing JWT auth with Nodejs, the Serverless framework, MongoDB and AWS Lambda.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published