Express JS #15 - Passport.js Authentication

  Рет қаралды 9,812

Anson the Developer

Anson the Developer

4 ай бұрын

Watch the full tutorial here: • Express JS Full Course
Code Repository: github.com/stuyy/expressjs-fu...
Support the Channel:
Become a Member: kzfaq.info...
Become a Patreon: / stuyy
Buy me a Coffee: ko-fi.com/anson
Donate on Streamlabs: streamlabs.com/ansondevacadem...
Donate on PayPal: paypal.me/ansonfoong
Connect with me:
Twitter: / ansonthedev
Discord: / discord
GitHub: github.com/stuyy
Twitch: / stuy

Пікірлер: 20
@danielwaduka5740
@danielwaduka5740 Ай бұрын
Thanks so much bro! I was getting frustrated with reading documentations and tutorials but without understanding the whole idea and implementation of Passport.js with express session. You really did a great job. Thanks.
@minecraftcookie2929
@minecraftcookie2929 Ай бұрын
thanks mate a lot ! I was having so much trouble here, i was using an email for auth but no matter what i did all i got was a bad request and then i learned about the options object from this video and now its working, thanks a lot !!!
@offgridvince
@offgridvince Ай бұрын
Cool! I'm ready for Google Authentication now...
@JaySuge
@JaySuge 3 ай бұрын
Thank you so much Anson my brother 👊 Big Inspiration
@David-me1ld
@David-me1ld 3 ай бұрын
Truly amazing thank you for this tutorial
@lukethompson4888
@lukethompson4888 2 ай бұрын
Legend! Great explanations
@kylebeattie8305
@kylebeattie8305 Ай бұрын
Thank you! Finally got my app to work after watching this
@uruta09
@uruta09 Ай бұрын
love your tutorials keep it up👌
@sourabh2907
@sourabh2907 3 ай бұрын
good job! Thanks for this video and the playlist! Its really simple to understand and follow.
@ansonthedev
@ansonthedev 2 ай бұрын
I'm glad to hear that!
@parth_patel2933
@parth_patel2933 Ай бұрын
thanks for this explanation
@noNullMoments
@noNullMoments 3 ай бұрын
Love your work mate. Could you please make a tutorial on the tricky bits with testing (ts-jest) like accessing the req.user or mocking middleware responses , testing behaviour of secure cookies , testing for cors. Mongoose typescript for defining schema statics and methods Much appreciated
@muhammadilman6866
@muhammadilman6866 2 ай бұрын
First of all thanks you for this awsome toturial. second can you tell me which font did you use it is very eye catching
@thejanvithanage
@thejanvithanage 15 күн бұрын
Thanks for this well formated tutorials. I have a question in stateless api how authentication work. This is a stateful api right?
@nileshgautam1408
@nileshgautam1408 3 ай бұрын
Hey Anson! Awesome tutorial, as always! Your explanations are clear and easy to follow. I've been implementing the login endpoint based on your guidance, and it's been smooth sailing so far. However, I've run into a slight snag. I was wondering if you could shed some light on how to handle different JSON responses based on whether the user enters a wrong username or a wrong password. Specifically, I'm aiming to receive a distinct JSON object for each scenario, along with a status code of 401. Any insights or tips on how to approach this would be greatly appreciated! Keep up the fantastic work!
@ansonthedev
@ansonthedev 3 ай бұрын
There never is a "wrong" username in a system. It just means the username does not exist. Many applications will not even indicate to the user that the username they entered doesn't exist, and who knows, maybe it may be useful info, but I don't think it is. If you want to do this however, I would just give a unique error code to the JSON object, such as "ERR_USERNAME_INVALID", so you know how to distinguish between different errors. If the username is invalid, that implies the password is invalid too (because if an account does not exist with the username then its password is irrelevant), so you don't need to display any message for the Password.
@anisslimatni2350
@anisslimatni2350 2 ай бұрын
Hi Anson, My Deserializer function has never been accessed, only serializer . how can I debug it? I don't know what I am missing
@mahdibhl4428
@mahdibhl4428 3 ай бұрын
Hi Anson, I really like your explanation. I just want to ask you a question: how can I redirect the user to the home page after login? I'm a beginner and I'm working with React for the frontend, and for the backend, I'm using Express.
@ansonthedev
@ansonthedev 3 ай бұрын
On the front-end, make a POST request to your authentication endpoint, e.g: POST /api/auth/login. Process the authentication logic and once it's successful, send back a 200 status code. On the front-end, remember when you make an API call, it is not fulfilled/completed until it receives a response back from the server. So you will be left with a Promise in Pending state that you can resolve by using async/await or .then/.catch. Resolve the promise and it should fulfill if it sends back a 200 status code. If the server sends back a 400/500 error code, then the promise will reject, meaning something happened with the server or the auth failed (password invalid). Once status code is 200, use React Router API to navigate the user to your desired page.
Express JS #16 - Databases with MongoDB
26:36
Anson the Developer
Рет қаралды 2,9 М.
Express JS #13 - Sessions Pt. 1
16:30
Anson the Developer
Рет қаралды 7 М.
Cat Corn?! 🙀 #cat #cute #catlover
00:54
Stocat
Рет қаралды 14 МЛН
когда повзрослела // EVA mash
00:40
EVA mash
Рет қаралды 4,5 МЛН
Despicable Me Fart Blaster
00:51
_vector_
Рет қаралды 17 МЛН
Senior Angular Developer Interview (theory)
41:57
WeCoded
Рет қаралды 10 М.
Passport JWT tutorial - Authentication with JSON Web Tokens
1:32:23
How to Create a Login with Google feature using Passport.JS
1:01:48
User verification email in nextjs
56:04
Hitesh Choudhary
Рет қаралды 26 М.
Express JS #10 - Validation
31:33
Anson the Developer
Рет қаралды 7 М.
NestJs Authentication : Login, Signup, Refresh Tokens, JWT, Guards
58:19
🤷🏻‍♂️Dad cheated in a game with his son😈😁
0:41
BorisKateFamily
Рет қаралды 7 МЛН
Почаще проводите время с Родителями 🥺❤️
0:51
Dragon Нургелды 🐉
Рет қаралды 671 М.
who is the champion of ludo luck balloon popping race ?
0:59
SS FOOD CHALLENGE
Рет қаралды 56 МЛН
Самая Благодарная Сестра ❤️
0:26
Глеб Рандалайнен
Рет қаралды 1,5 МЛН