Overview
Learn how to protect routes and secure API endpoints in a Node.js/Express application with authentication. Expand on previous knowledge by adding pages accessible only when logged in and creating a secured API called from the web app. Follow along to create a second route in the web app, implement EJS templating, secure routes with Auth0, develop a simple Express-based API with public and private endpoints, integrate API responses using Axios, and configure the web app to request access tokens. Gain practical insights into implementing authentication and authorization in your Node.js projects, enhancing the security of your web applications and APIs.
Syllabus
0:00 Hello!
Create a second route in the Web App
Create a second EJS template for this new route
Use EJS includes to extract common markup into one file
Secure the second route with Auth0
Create a simple Express-based API with a public endpoint
Pull API responses into the Web App using Axios
Create a private endpoint in the API
Pass authorization headers to the API from the Axios call
Configure the Web App to request an Access Token from Auth0
The final result and closing comments
Taught by
Okta