REST API Authentication and Authorization - Explanation + Full Node.js Tutorial

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024

Комментарии • 57

  • @ssemugabielijah
    @ssemugabielijah 4 дня назад

    16:36 Register Route
    29:05 Login Route
    33:19 jwt

  • @kevin-howard
    @kevin-howard 5 месяцев назад +3

    The best explanation for JWT authentication for an API. Thanks a lot !😁

    • @manfraio
      @manfraio  5 месяцев назад

      Thank you🤜🏻🤛🏻

  • @manuelcastillo7623
    @manuelcastillo7623 3 месяца назад +3

    Hi, I'm just starting to watch your video and Wow! It's pure gold. Thank you so much for the time you spent creating it. I'm going to watch it all the way through because I know I'm going to learn a lot. Thanks again!!

    • @manfraio
      @manfraio  3 месяца назад

      Thank you very much my friend. 🤜🏻🤛🏻

  • @huan.francischinelli
    @huan.francischinelli 4 месяца назад +1

    Mano, ja que eu vi que tu é BR no github, vou falar no bom e velho português mesmo. Simplesmente insano teu conteúdo, tava procurando um videozinho simples pra ver a sintaxe do express (venho do Flask), acabei ficando o video todo pela aula de ENGENHARIA DE SOFTWARE. Insano um conteúdo PREMIUM desse ainda não ser tão conhecido, dá pra ver que é dev raiz e não dev copia e cola vendedor de curso. FODA.

    • @manfraio
      @manfraio  4 месяца назад

      Opa Huan, muito obrigado pelo comentário. Fico feliz que tenha gostado do conteúdo. Abraço

  • @ahmeteyupuslu
    @ahmeteyupuslu 6 месяцев назад +1

    Your explanations are very clear, and the examples are great to follow. Thanks for the videos!

    • @manfraio
      @manfraio  6 месяцев назад

      Thank you🤜🏻🤛🏻

  • @skuder491
    @skuder491 3 месяца назад

    Excelente vídeo, meu amigo! Didático e direto ao ponto. Tirou-me algumas grande dúvidas que eu possuía sobre o mecanismo de Refresh Token.
    Muito obrigado!

    • @manfraio
      @manfraio  3 месяца назад +1

      Fico feliz por ter ajudado. Grande abraço.

  • @cosanostraytc1030
    @cosanostraytc1030 4 месяца назад +1

    Keep it up man!!! Great channel. Thank you

  • @devBuddy
    @devBuddy 3 месяца назад

    WoW! thank you so much for putting all this together, very professional.

    • @manfraio
      @manfraio  3 месяца назад

      Thank you🤜🏻🤛🏻

  • @VijendraShekhawat-cc7wn
    @VijendraShekhawat-cc7wn 6 месяцев назад +1

    Thank you very much.
    Very nice explanation.
    I have subscribed the channel as well.
    Please make more content and try to cover it up fully.
    Whichever topic you teach, I will always like to watch, even if i know the same.

    • @manfraio
      @manfraio  6 месяцев назад +1

      Thank you my friend🤜🏻🤛🏻

  • @tylerarrigoni7700
    @tylerarrigoni7700 6 месяцев назад

    Nicely done! This is excellent so far!

  • @HarryHanson-r8n
    @HarryHanson-r8n 2 месяца назад

    Thank you very much for a great tutorial

  • @AjaySingh-jz8qx
    @AjaySingh-jz8qx 6 месяцев назад +3

    Nice tutorial can you please show a little integration of this with a simple login form in a frontend

    • @manfraio
      @manfraio  6 месяцев назад +1

      Yes, soon we’ll have more frontend videos as well.

    • @opeyemiodunayo8891
      @opeyemiodunayo8891 6 месяцев назад +1

      Not more frontend video first, but a simple login form in the frontend for better clarification of integration thanks

    • @blank_bow
      @blank_bow 6 месяцев назад

      @@manfraio your contents are too different, in details and excellent. But there are very less content on web on backend ( at least of your quality). Can you please make contents on how we can make a platform, which can scale to millions?

  • @GauravSingh-747
    @GauravSingh-747 6 месяцев назад

    Very nice explanation.

  • @gregscolumn
    @gregscolumn Месяц назад

    this is a great tutorial I implemented this on a Nuxt App I was working on. Can you please make a video on how to set reset password endpoint?

    • @manfraio
      @manfraio  Месяц назад +1

      Thank you for the comment.
      Yes, I’ll do soon a video about the reset password endpoint.

  • @pallavibhaskar1107
    @pallavibhaskar1107 5 месяцев назад

    thanks bro! great explanation

  • @Dnsl1796
    @Dnsl1796 2 месяца назад

    Could you please create a full-stack project using modern popular tech? I truly appreciate the time and effort you've invested in creating such amazing videos.

    • @manfraio
      @manfraio  2 месяца назад +2

      Thank you for your comment. For next year we’ll have full stack videos with react and react native as well.
      We’ll also have a website with templates that we can use for the frontend. Stay tuned my friend.

  • @mohammadforutan341
    @mohammadforutan341 Месяц назад

    ❤❤❤ thanks 👍

  • @roshanxavier4472
    @roshanxavier4472 2 месяца назад

    This is great

  • @MustafaAli-ve1vm
    @MustafaAli-ve1vm Месяц назад

    @manfraio Thanks a lot!
    Access and refresh tokens help in preventing replay attacks.
    Ideally, blacklisting both will prevent an attacker from using a sniffed AT or RT to gain access to the system when the user is logged out AND the token is not yet expired.
    (Side Note: in case the user is already logged in and the hacker was able to obtain his AT or RT and use it; this can be detected from the list of concurrent sessions of that user then the system can take actions accordingly; maybe block the user's account or log them out "both"...etc).
    However, it creates an overhead on the backend server and DB due to the logout-login pattern of many users.
    That is when many users log out (blacklist each AT and RT) then log in (create new AT and RT) then logout (blacklist newly created AT and RT) and so on.
    On the DB side, a "clean-up" job could remove expired AT and RT.
    Therefore, I think the meet-me-in-the-middle solution is to delete the RT and blacklist AT until it expires then the system (e.g DB job) can safely delete it.
    Much appreciated!

    • @manfraio
      @manfraio  Месяц назад +1

      Thank you for the comment. You point some interesting facts here👍🏻

  • @IntrovertedCoder
    @IntrovertedCoder 5 месяцев назад

    Hi Manfra! Would you please make a tutorial on pagination, filtering and sorting of API in Node?

    • @manfraio
      @manfraio  5 месяцев назад

      Yes, we’re gonna post soon.

  • @blank_bow
    @blank_bow 6 месяцев назад

    Thank you Sir.

  • @miguelangelHernaiz-je6dy
    @miguelangelHernaiz-je6dy 5 месяцев назад

    thanks a lot!!

  • @levybenie3331
    @levybenie3331 5 месяцев назад

    Thx for this video.
    What extensions do you use for node js please ?

    • @manfraio
      @manfraio  5 месяцев назад +1

      I don’t use many extensions:
      JavaScript Snippets, Live Server, one for Markdown Preview, DotEnv support, EJS language support, Color Hightlight (for css colors)

  • @MustafaAli-ve1vm
    @MustafaAli-ve1vm Месяц назад

    Great Video!
    Just a question here;
    why Blacklist AT and delete RT?
    why not delete both tokens?
    why not delete AT and blacklist RT?
    why not blacklist both tokens?

    • @manfraio
      @manfraio  Месяц назад +1

      Thank you for the comment.
      The AT we’re not storing anywhere. Just sending directly on the response. To invalidate the AT then we need to store somewhere to check if that AT is invalid (in case the user already logged out).
      The RT we are storing on the DB. So in that case we need to delete.
      You could store both the AT and RT on the database as well, and create a boolean flag to invalidate the AT. It all depends on the way you want to work.

    • @MustafaAli-ve1vm
      @MustafaAli-ve1vm Месяц назад

      @@manfraio Thanks a lot!
      Access and refresh tokens help in preventing replay attacks.
      Ideally, blacklisting both will prevent an attacker from using a sniffed AT or RT to gain access to the system when the user is logged out AND the token is not yet expired.
      (Side Note: in case the user is already logged in and the hacker was able to obtain his AT or RT and use it; this can be detected from the list of concurrent sessions of that user then the system can take actions accordingly; maybe block the user's account or log out "both").
      However, it creates an overhead on the backend server and DB due to the logout-login pattern of many users.
      That is when many users log out (blacklist each AT and RT) then log in (create new AT and RT) then logout (blacklist newly created AT and RT) and so on.
      On the DB side, a "clean-up" job could remove expired AT and RT.
      Therefore, I think the meet-me-in-the-middle solution is to delete the RT (since there is nothing to compare against between user's RT AND server's RT; deleted one) and blacklist AT until it expires then the system (e.g DB job) can safely delete it.
      Much appreciated!

    • @MustafaAli-ve1vm
      @MustafaAli-ve1vm Месяц назад

      @@manfraio Thanks a lot!
      Access and refresh tokens help in preventing replay attacks.
      Ideally, blacklisting both will prevent an attacker from using a sniffed AT or RT to gain access to the system when the user is logged out AND the token is not yet expired.
      (Side Note: in case the user is already logged in and the hacker was able to obtain his AT or RT and use it; this can be detected from the list of concurrent sessions of that user then the system can take actions accordingly; maybe block the user's account or log them out "both").
      However, it creates an overhead on the backend server and DB due to the logout-login pattern of many users.
      That is when many users log out (blacklist each AT and RT) then log in (create new AT and RT) then logout (blacklist newly created AT and RT) and so on.
      On the DB side, a "clean-up" job could remove expired AT and RT.
      Therefore, I think the meet-me-in-the-middle solution is to delete the RT and blacklist AT until it expires then the system (e.g DB job) can safely delete it.
      Much appreciated!

    • @MustafaAli-ve1vm
      @MustafaAli-ve1vm Месяц назад

      @@manfraio Thanks a lot!
      Access and refresh tokens help in preventing replay attacks.
      Ideally, blacklisting both will prevent an attacker from using a sniffed AT or RT to gain access to the system when the user is logged out AND the token is not yet expired.
      (Side Note: in case the user is already logged in and the hacker was able to obtain his AT or RT and use it; this can be detected from the list of concurrent sessions of that user then the system can take actions accordingly; maybe block the user's account or log them out "both"...etc).
      However, it creates an overhead on the backend server and DB due to the logout-login pattern of many users.
      That is when many users log out (blacklist each AT and RT) then log in (create new AT and RT) then logout (blacklist newly created AT and RT) and so on.
      On the DB side, a "clean-up" job could remove expired AT and RT.
      Therefore, I think the meet-me-in-the-middle solution is to delete the RT and blacklist AT until it expires then the system (e.g DB job) can safely delete it.
      Much appreciated!

    • @MustafaAli-ve1vm
      @MustafaAli-ve1vm Месяц назад +1

      @@manfraio Thanks a lot!
      Access and refresh tokens help in preventing replay attacks.
      Ideally, blacklisting both will prevent an attacker from using a sniffed AT or RT to gain access to the system when the user is logged out AND the token is not yet expired.
      (Side Note: in case the user is already logged in and the hacker was able to obtain his AT or RT and use it; this can be detected from the list of concurrent sessions of that user then the system can take actions accordingly; maybe block the user's account or log them out "both"...etc).
      However, it creates an overhead on the backend server and DB due to the logout-login pattern of many users.
      That is when many users log out (blacklist each AT and RT) then log in (create new AT and RT) then logout (blacklist newly created AT and RT) and so on.
      On the DB side, a "clean-up" job could remove expired AT and RT.
      Therefore, I think the meet-me-in-the-middle solution is to delete the RT and blacklist AT until it expires then the system (e.g DB job) can safely delete it.
      Much appreciated!

  • @opeyemiodunayo8891
    @opeyemiodunayo8891 6 месяцев назад

    Show a little integration with a simple login form on the frontend please

    • @manfraio
      @manfraio  6 месяцев назад +4

      Yes, there will be a frontend video, using vanilla JavaScript with HTML and CSS consuming this API.

  • @danieljsadananda2163
    @danieljsadananda2163 2 месяца назад

    Hi Bro .
    Where can i store Refresh token secret for each user in real world Web application .
    Since access token is temporary ,so i wouldn't like to store it anywhere .
    But i am thinking refresh token secret .
    Plz tell me what can I do

    • @manfraio
      @manfraio  2 месяца назад

      Sure, you can store the refresh token in a DB, inside a refresh tokens table (make sure to store the userId as well) or directly inside the user’s table.

  • @blank_bow
    @blank_bow 6 месяцев назад

    Can you please do the next on SSO?

    • @manfraio
      @manfraio  6 месяцев назад +1

      We’ll add videos with SSO in the future. Actually entire projects.
      There are just a few other videos on the line.

    • @blank_bow
      @blank_bow 6 месяцев назад

      @@manfraio waiting for all of your videos. Truly awesome.

    • @manfraio
      @manfraio  6 месяцев назад +1

      @blank_bow thank you🤜🏻🤛🏻

  • @thapthoptheep2076
    @thapthoptheep2076 3 месяца назад

    Appreciate this, much obliged.

  • @zenabhi0072
    @zenabhi0072 5 месяцев назад

    Thanx man