NestJs REST API with MongoDB #5 - Authorization, Protect Routes, Current User and more

  Рет қаралды 11,928

Coding With Abbas

Coding With Abbas

Жыл бұрын

Final Code:
github.com/ghulamabbas2/libra...
Complete In-Depth NestJs UDEMY Courses:
www.udemy.com/course/nestjs-b...
⚙️ Gadgets I use for Recording:
💻 Laptop - Macbook PRO M1 - 16/512
amzn.to/3LbihZB
🎤 MIC - Samson Technologies Q2U USB/XLR Dynamic Microphone
amzn.to/3JoOaMN
🖱️Mouse - Logitech M330 SILENT PLUS Wireless Mouse
amzn.to/3mvDlzu
⌨️ Keyboard - Logitech K380 Multi-Device Bluetooth Keyboard
amzn.to/3T7aCgS
🖥️ Monitor - UltraSharp 24-Inch Screen Led-Lit Monitor (U2419H)
amzn.to/3FazdeK
In this video, we will learn how we can protect our routes from unauthenticated users in our NestJS API. In my previous videos, I created a complete CRUD Library API.
In this video, we will continue with that project and create our JWT Strategy, protect the routes,, and also we will save the current user in the book that is created by user in simple few steps.
If you like this video make sure to subscribe and share, and stay tuned for more coding videos.

Пікірлер: 30
@princepiyushsingh5758
@princepiyushsingh5758 Жыл бұрын
This is exactly what I am searching and you have explained it very well. Thank you
@muhammadmuneebwaseem504
@muhammadmuneebwaseem504 3 ай бұрын
Great course brother. Learning Nestjs for the first time and you nailed it! Thanks once again.
@phvntiendat
@phvntiendat Жыл бұрын
This is by far the best course I've ever came across. Thank you
@codingwithabbas
@codingwithabbas Жыл бұрын
Glad it was helpful!
@alexmuchiri7786
@alexmuchiri7786 11 ай бұрын
Amazing work @Abbas. God bless
@sepsartist7538
@sepsartist7538 Жыл бұрын
Bro, This is exactly what is was searching. JAZAK ALLAH.
@AFUSquad
@AFUSquad Жыл бұрын
great job ur videos tut helpful for me to doing uni project tyty
@codingwithabbas
@codingwithabbas Жыл бұрын
Glad I could help!
@awaraamin6850
@awaraamin6850 6 ай бұрын
Great work
@tomascaetano4270
@tomascaetano4270 Жыл бұрын
Superb 🎉🎉🎉
@ashishkumari-yg4gn
@ashishkumari-yg4gn Жыл бұрын
Thank you sir
@lucasdamasceno7068
@lucasdamasceno7068 Жыл бұрын
great course bro, thanksss. it's more used the express or the nestjs ?
@codingwithabbas
@codingwithabbas Жыл бұрын
NestJS is built on top of Express.js
@ezequielotoni3228
@ezequielotoni3228 Жыл бұрын
I am having a problem when i send the token in header. Parameter "filter" to find() must be an object, got "648a3b0c5f8e038f7ed52ab9" (type string). I dont know how to fix
@ShahabMusharraf-ug8lu
@ShahabMusharraf-ug8lu Ай бұрын
Why do we not saved the token in cookie?
@sifenbeshada8416
@sifenbeshada8416 5 ай бұрын
How to implement a role-based authorization
@AFUSquad
@AFUSquad Жыл бұрын
How about update and delete by check the user is owned the book
@codingwithabbas
@codingwithabbas Жыл бұрын
You can add if check and make sure the user is same. if(req.user._id != book.user) then throw the error.
@gisssk9236
@gisssk9236 5 ай бұрын
i got this ploblem [Nest] 19392 - 01/22/2024, 5:06:53 PM ERROR [ExceptionsHandler] Cannot read properties of undefined (reading '_id') TypeError: Cannot read properties of undefined (reading '_id') can enyone help me out this issues please
@Savangex
@Savangex 5 ай бұрын
I have the same issue, have you found a solution yet?
@mokhlestarmiz743
@mokhlestarmiz743 5 ай бұрын
@@Savangex same here :(
@phantazzor
@phantazzor 3 күн бұрын
the user is simply undefined
@spizer98
@spizer98 Жыл бұрын
how to implement logout functionality
@codingwithabbas
@codingwithabbas Жыл бұрын
This will be implemented on the frontend. We just need to clear the token.
@spizer98
@spizer98 Жыл бұрын
@@codingwithabbas what if anyone copy the token use it to login so there might be a security problem
@codingwithabbas
@codingwithabbas Жыл бұрын
We store our token at safe place, like httpOnly cookies, that cannot be accessed from frontend,
@zekariyasmulugetaaltaye1065
@zekariyasmulugetaaltaye1065 Жыл бұрын
@@codingwithabbas Can we send an httpOnly Cookie instead of returning the jwt when the user logs in or signs up. and if we can are there things we should change in the passport strategy? and want to say thank you for the great tutorial
@chugia6118
@chugia6118 Жыл бұрын
do you have a course like small facebook app with some functionality as like, comment, notification...on udemy pros, I need for build project like that!
@nathanzebedee5263
@nathanzebedee5263 Жыл бұрын
awuawodawd
@ShahabMusharraf-ug8lu
@ShahabMusharraf-ug8lu Ай бұрын
Why do we not saved the token in cookie?
How to Manage User Access in NestJS | Authorization with CASL
46:20
Marius Espejo
Рет қаралды 39 М.
Luck Decides My Future Again 🍀🍀🍀 #katebrush #shorts
00:19
Kate Brush
Рет қаралды 8 МЛН
Build Complete REST API in NestJs #1 - with TypeScript & MongoDB
31:05
Coding With Abbas
Рет қаралды 55 М.
The ultimate NestJS Authentication guide
31:00
Tech Vision
Рет қаралды 444
NestJs - Guards & Authentication & Authorization [08]
33:05
Computerix
Рет қаралды 8 М.
What is an API and how do you design it? 🗒️✅
15:26
Gaurav Sen
Рет қаралды 713 М.
How to build a REST API with Node js & Express
58:40
Programming with Mosh
Рет қаралды 1,7 МЛН
NestJs Authentication : Login, Signup, Refresh Tokens, JWT, Guards
58:19