Auth via Auth0 github.com/serverless/forms-service
Backend •
Node backend running in AWS Lambda Functions
•
DynamoDB noSQL for database
•
Authorization via API Gateway Custom Authorizer Function
github.com/serverless/forms-service
serverless backend
watch Serverless Authentication and Authorization
http://bit.ly/aws-auth
Custom Authorizer Flow
1. Create a new auth0 client
2. Make it a SPA
3. Note the Domain & Client ID values
4. Install the auth0 Authorization extension
5. setup permissions/groups/roles
6. create a new auth0 Rule to add roles to JWT
6b. attach the users roles to the JWT on login via rule
7. plug in auth0 clientID & auth0 domain to frontend + backend frontend _config.js
backend config.prod.json
8. Deploy Backend
Take your API endpoints and plug them into the UI
8b. Add API endpoints to frontend App
9. Deploy Frontend
- Builds on github repo events (CI/CD flow) - Automatic Branch previews ⚡ - static site redirects via `_redirects` file 👌 - Handles proxied URLs - this gives us escape hatches for
dynamic pages/content - Super cheap - amazing support - 💕 them
Custom Authorizer Implementation
see code: bit.ly/auth-code
serverless.yml config file
Where to run What to run When to run
handler.js file
named export saveUser function is referenced in serverless.yml
serverless deploy in cwd
framework packages & deploys code
returns live API endpoints
Serverless Use Cases for serverless.com - Web forms - Custom APIs - Automatic thumbnail generation - New user welcome emails - Lead revisit notifications - Showing related content on blog - Site search (Algolia) - Content A/B testing - Doc feedback