Web Dev Roadmap for Beginners (Free!): bit.ly/DaveGrayWebDevRoadmap
Learn MERN Stack Authentication and Authorization with JWT Access & Refresh Tokens and secure cookies. Create auth routes and an auth controller for a REST API that will handle authentication and issue JWT tokens for valid users.
💖 Support me on Patreon ➜ / davegray
⭐ Become a full-stack web dev with Zero To Mastery Courses:
- Advanced React & Redux: bit.ly/AdvReactDev
- The Complete Node.js Developer: bit.ly/CompleteNodeJS
- Jr to Senior Web Dev Roadmap: bit.ly/WebDevRoadmap-JrtoSr
🚩 Subscribe ➜ bit.ly/3nGHmNn
📬 Course Updates ➜ courses.davegray.codes/
🚀 Discord ➜ / discord
☕ Buy Me A Coffee ➜ www.buymeacoffee.com/davegray
👇 Follow Me On Social Media:
Github: github.com/gitdagray
Twitter: / yesdavidgray
LinkedIn: / davidagray
🔗 All Resources for this MERN Stack Project: github.com/gitdagray/mern_sta...
🔗 Playlist for this MERN Stack Project Series: bit.ly/3Sn4EaI
MERN Stack Authentication with JWT Access, Refresh Tokens, Cookies
(00:00) Intro
(00:09) Welcome
(00:22) Quick lessons recap
(00:55) Authentication vs Authorization
(01:49) Starter Code
(02:12) Add auth routes to server
(02:42) Auth routes router
(04:26) Rate limiting middleware
(07:47) Auth controller
(10:07) Adding controller methods to auth routes
(11:01) Understanding the JWT auth process
(13:13) Create token secrets with Node.js
(15:34) login method in auth controller
(20:13) refresh method in auth controller
(22:31) logout method in auth controller
(23:29) Create middleware to verify JWTs
(26:51) Apply verifyJWT middleware to routes
(28:44) Test the login endpoint with Postman
(31:23) Test the refresh endpoint with Postman
(32:33) Test the logout endpoint with Postman
(33:15) Test the verifyJWT middleware with Postman
📚 Suggested Pre-requisites for this MERN course:
🔗 Node.js for Beginners full course: • Node.js Full Course fo...
🔗 React JS for Beginners full course: • React JS Full Course f...
🔗 Redux Toolkit for Beginners full course: • React Redux Full Cours...
🔗 React Login Playlist: • React Login, Registrat...
📚 Tutorial References:
🔗 Express Rate Limiter: www.npmjs.com/package/express...
🔗 jsonwebtoken: www.npmjs.com/package/jsonweb...
Was this MERN Stack Authentication tutorial helpful? If so, please share. Let me know your thoughts in the comments.
#mern #stack #authentication
5 авг 2024