Protecting Routes and Securing API Endpoints in Node.js/Express | Express and Auth Series Part 3
Channel: OktaDev
Date: 2023-03-07

This video was originally published on Aug 26, 2021.

Authentication lets you control access to web application routes and API endpoints -- it's not just about knowing who's logged in. This video expands on previous episodes, taking our authenticated Node.js/Express web application, adding pages that can only be accessed when logged in, and creating a secured API that's called from the web app.

If you don't have your Node.js/Express app going already, check out the previous episodes, which will help you do just that:

- Episode 1: Getting started with Node.js/Express and EJS templating https://youtu.be/eg244TvZHyU

- Episode 2: Add Authentication to Existing Node.js/Express Apps with Auth0 https://youtu.be/HTjfDUm1RsU

Chapter Markers:
0:00 Hello! 0:37
What's in this video?
1:30 Create a second route in the Web App
2:16 Create a second EJS template for this new route
3:24 Use EJS includes to extract common markup into one file
4:22 Secure the second route with Auth0
5:38 Create a simple Express-based API with a public endpoint
8:05 Pull API responses into the Web App using Axios
10:54 Create a private endpoint in the API
16:00 Pass authorization headers to the API from the Axios call
17:45 Configure the Web App to request an Access Token from Auth0
20:58 The final result and closing comments

___________________________________________ 
Learn with Auth0 by Okta
Try Auth0 for free - https://a0.to/yt-signup 
The Auth0 by Okta blog - https://a0.to/blog 
___________________________________________ 
Follow Us on Social 
Twitter - https://twitter.com/oktadev
LinkedIn - https://www.linkedin.com/company/oktadev