Express JS #15 - Passport.js Authentication

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ต.ค. 2024

ความคิดเห็น • 28

  • @izzyvickers6258
    @izzyvickers6258 วันที่ผ่านมา

    My guy… everything I watched.. you are the ONLY one that made this all make sense. The serialize and deserialoze was hard for me to wrap my head around. Thanks a bunch!!

  • @danielwaduka5740
    @danielwaduka5740 4 หลายเดือนก่อน +5

    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.

  • @offgridvince
    @offgridvince 4 หลายเดือนก่อน +4

    Cool! I'm ready for Google Authentication now...

  • @minecraftcookie2929
    @minecraftcookie2929 5 หลายเดือนก่อน +2

    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 !!!

  • @collinskariuki7089
    @collinskariuki7089 2 หลายเดือนก่อน

    Thank you so much for this very useful tutorial. I was completely stuck on how to use Passport and express and your video explained everything very clearly. Thank you. You've earned a new subscriber.

  • @David-me1ld
    @David-me1ld 7 หลายเดือนก่อน +1

    Truly amazing thank you for this tutorial

  • @sourabh2907
    @sourabh2907 6 หลายเดือนก่อน +2

    good job! Thanks for this video and the playlist! Its really simple to understand and follow.

    • @ansonthedev
      @ansonthedev  6 หลายเดือนก่อน

      I'm glad to hear that!

  • @noNullMoments
    @noNullMoments 7 หลายเดือนก่อน +1

    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

  • @GL33T
    @GL33T 2 หลายเดือนก่อน

    bro is out here saving lives , shout out to Anson!

  • @kylebeattie8305
    @kylebeattie8305 4 หลายเดือนก่อน

    Thank you! Finally got my app to work after watching this

  • @JaySuge
    @JaySuge 6 หลายเดือนก่อน +1

    Thank you so much Anson my brother 👊 Big Inspiration

  • @thejanvithanage
    @thejanvithanage 3 หลายเดือนก่อน

    Thanks for this well formated tutorials. I have a question in stateless api how authentication work. This is a stateful api right?

  • @muhammadilman6866
    @muhammadilman6866 6 หลายเดือนก่อน +1

    First of all thanks you for this awsome toturial. second can you tell me which font did you use it is very eye catching

  • @lukethompson4888
    @lukethompson4888 5 หลายเดือนก่อน +1

    Legend! Great explanations

  • @aninexclusive466
    @aninexclusive466 9 วันที่ผ่านมา

    Excellent!!

  • @parth_patel2933
    @parth_patel2933 4 หลายเดือนก่อน

    thanks for this explanation

  • @nileshgautam1408
    @nileshgautam1408 7 หลายเดือนก่อน

    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  6 หลายเดือนก่อน +2

      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 5 หลายเดือนก่อน

    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 6 หลายเดือนก่อน

    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  6 หลายเดือนก่อน +4

      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.

  • @uruta09
    @uruta09 4 หลายเดือนก่อน

    love your tutorials keep it up👌

  • @gooby8379
    @gooby8379 หลายเดือนก่อน

    Hello, brother I hope you can help me with my issue, google chrome browser to set cookies rather then other browsers works very fine. Have you ever encountered this issue and fixed it, if so can you help me please ?

    • @ansonthedev
      @ansonthedev  หลายเดือนก่อน

      No clue aside from I’d check your browser extensions such as adblockers, which can sometimes conflict with cookies.

  • @caballerosalas
    @caballerosalas 15 วันที่ผ่านมา

    37 minutes to say something you could have explain in 5

    • @ansonthedev
      @ansonthedev  15 วันที่ผ่านมา +2

      Then make a video yourself explaining, coding, testing everything in 5 minutes and let’s see if people understand what you’re talking about. :)

    • @YLLIEEGD
      @YLLIEEGD 2 วันที่ผ่านมา

      @@ansonthedev dw haters gonna hate