ASP.NET 7 JWT Authentication and Role-Based Authorization | ASP.NET Web API

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

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

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

    If You want to see how we use JWT in a real-world full-stack project, watch this tutorial:
    th-cam.com/video/tAUVG1p0NNY/w-d-xo.html

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

    Thank you so much mohammad for providing such quality content in youtube.Really appreciates your effort.

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

      Thanks for Your support my friend 🌹

  • @sandakelumhalkewela7854
    @sandakelumhalkewela7854 ปีที่แล้ว +1

    what a nice project and nice explanation. I have learned many things from your videos. i accidentally got suggested this and its worth a lot to me. i hope you will post many videos like this. underrated content

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว

      Thanks Sandakelum. I appreciate that 🌹

    • @kresimirsumiga1584
      @kresimirsumiga1584 ปีที่แล้ว

      @@DevEmpower Excellent tutorial, by far the most comprehensive one I have watched. But, I have one question: @40:29 you add migrations, and core makes predefined database tables, but I already have a User in my database; how do I make migration files based on my User instead of AspNetUsers? Thank you!

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว

      @@kresimirsumiga1584 Thanks.
      Before migration, You don't have the tables. How you can have user?
      If You have an existing database, You need to use database-first approach. In this tutorial, I used code-first approach

    • @kresimirsumiga1584
      @kresimirsumiga1584 ปีที่แล้ว

      @@DevEmpower Thank you for the reply! Sorry, I wasn't clear... I would use this approach, but I would like that the AspNetUsers table contain additional columns because table User that I would work with is very much similar to this predefined table, can it be done, to add a few more columns to AspNetUsers table, and how can it be done?

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว

      @@kresimirsumiga1584 Yes, please continue watching. In section 2 this is implemented.

  • @enricoroselino7557
    @enricoroselino7557 9 หลายเดือนก่อน +1

    thank you, very clear and able to replicate at .net 8

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

      You're welcome my friend 🌹♥

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

    Very Informational video, please add video to how to use this in CRUD APIs.

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

      Thanks, my friend.
      You can check this video:
      th-cam.com/video/tAUVG1p0NNY/w-d-xo.html

  • @MuhammadShahid-zt9ck
    @MuhammadShahid-zt9ck 11 หลายเดือนก่อน

    very nice explanation that show your depth experience. thank you sir

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

      Thanks my friend. I'm happy it was useful 🌹❤

  • @serg1778
    @serg1778 ปีที่แล้ว +2

    I wish you more subscribers.It's worth it )

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว +1

      Thank you for support 🌹

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

    This is an informative video, and it is very detailed. But what of the logout part.

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

      Thanks my friend.
      In backend, You don't need logout.
      You can watch this video to see how we can implement logout in front-end:
      th-cam.com/video/tAUVG1p0NNY/w-d-xo.htmlsi=0wjCY2dBefWp1cdq

  • @FahadKhan-fq4zw
    @FahadKhan-fq4zw 8 หลายเดือนก่อน

    Very nice and well explained tutorial , everything at one place. Out of context can you please let me know which theme you are using for google chrome , the Arabic once. I really like it.

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

      Thanks, my friend. 🌹♥
      I don't use any specific theme for Google Chrome. It is the standard chrome.

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

    thank you , its was helpful

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

      You're welcome my friend 🌹♥

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

    Incredible thanks bro!!

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

      Thanks for your comment my friend 🌹

  • @khalidsultani1896
    @khalidsultani1896 ปีที่แล้ว +1

    thanks for this awesome video . please add refresh token and change password also in future play list if you get time.

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว

      Thanks for your comment my friend. In the future I will🌹

  • @codewithgilly
    @codewithgilly ปีที่แล้ว +1

    Great Stuff

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว

      Thanks for you comment bro. 🌹

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

    Good one where users Roles Defined when register the users?

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

      Thanks. We are adding a default role to user in: AurhService line: 150 with this command:
      await _userManager.AddToRoleAsync(newUser, StaticUserRoles.USER);

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

    muchas gracias por este contenido, es lo mejor

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

      🌹❤

  • @MohamedRamzy-u1b
    @MohamedRamzy-u1b ปีที่แล้ว +2

    pls can you add refresh token to this project I think it will help a lot

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว +1

      Of course, I will 🌷

  • @stewieshka
    @stewieshka ปีที่แล้ว

    It would be great if you showed the implementation of the frontend.

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว

      Currently, I am so busy because of some interviews. But I will create the implementation video in React library as soon as possible. 🌹

  • @یاسینیاسینی-ح9خ
    @یاسینیاسینی-ح9خ 8 หลายเดือนก่อน

    Very good english duste man🤣🤣

    • @DevEmpower
      @DevEmpower  8 หลายเดือนก่อน +1

      Thanks my friend 🌹❤

  • @abdurrehman7820
    @abdurrehman7820 ปีที่แล้ว

    Thanks Bro....❤❤❤❤

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว

      I hope it was useful. Thanks for your comment ❤🌹

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

    how can we use this login method in another mvc application ? i mean for the admin panel

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

      You can install Identity package on that project. Then you can implement the same functionalities.
      But, Usually the MVC projects doesn't use token and jwt. they use session-based authentication (cookies). I will create a tutorial about it later

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

      @@DevEmpower so 2 identity package 1 for APi 1 for mvc app

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

      @@thesandboxgamingvideos
      It really depends on Your Structure.
      Basically, When You have an MVC Project, You don't need API project. You can implement Some API Controllers directly in your MVC Project.
      I hope I answered true based on your question.
      If you describe your project more, It is easier to answer.

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

      @@DevEmpower every dev youtuber explains JWT with Login methods so i thought JWT was for admin panels. thats why i asked that. it's actually proctecting API project not login

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

      @@thesandboxgamingvideos
      Generally speaking, JWT protect your controllers and http methods.

  • @nouchance
    @nouchance ปีที่แล้ว +1

    THANK YOU🎉

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว

      Thank you for comment🌹

  • @PeterMadz-cu6el
    @PeterMadz-cu6el 11 หลายเดือนก่อน

    i am getting 401 unauthorised in postman after testing my token? My code is like yours

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

      Please compare Your codes with GitHub repo again. As you saw in the video, I'm writing and explaining the codes step by step to avoid any type of misunderstandings.
      Also, You can debug Your code to find the problem.
      In this video, I talked about debugging:
      th-cam.com/video/n7-DWyGtdW0/w-d-xo.html
      Hope it helps You 🌹❤

    • @PeterMadz-cu6el
      @PeterMadz-cu6el 11 หลายเดือนก่อน

      It have compared and everything is the same. It only works when i change issuer and audience to false like below: Can you explain why?
      ValidateIssuer = false,
      ValidateAudience = false,
      ValidIssuer = builder.Configuration["JWT:ValidIssuer"],
      ValidAudience = builder.Configuration["JWT:ValidAudience"],@@DevEmpower

    • @PeterMadz-cu6el
      @PeterMadz-cu6el 11 หลายเดือนก่อน

      thank you 🙂

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

    I need to see how you made the database

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

      I made it step by step in the tutorial bro. Which part is not clear?

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

      the creation of the tables@@DevEmpower

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

      @@kalixgz We don't create tables manually. We use EntityFrameworkCore package. First we create some entities and then we create a context for them. Then we create a migration and we update our database. This process is explained in video.

  • @cana_369
    @cana_369 ปีที่แล้ว

    Can you make full e-commerce API with jwt

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว

      In future, I will ♥

  • @sport6576
    @sport6576 ปีที่แล้ว

    integrate it with reactjs please

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว

      I will 🌹

    • @Kazoda
      @Kazoda ปีที่แล้ว

      @@DevEmpower Hi, Have you already done that?

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว

      @@Kazoda Not Yet 😊
      Currently, I'm making another tutorial: Books Store MERN Stack. But after finishing it, I will implement using JWT in react and Next JS
      🌹❤

    • @Kazoda
      @Kazoda ปีที่แล้ว

      @@DevEmpower Okay, thank you :)

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว

      @@Kazoda You're welcome my friend ❤

  • @amirabbas667
    @amirabbas667 ปีที่แล้ว +1

    اگه ممکنه زیرنویس ویدیو رو فعال کنید

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว

      امیرجان مرسی از کامنت
      متاسفانه کامیونیتی فارسی اصلا استقبالی نمیکنن و متاسفانه وقت گذاشتن روی این موضوع هیچ فایده ای نداره، برای زیرنویس فارسی باید بشینم فایل زیرنویس فارسی تهیه کنم برای ویدیو که خیلی زمانبر هست و استقبالی هم نمیشه، بهمین خاطر کامل سوییچ کردم روی انگلیسی
      در عین حال، شما ویدیو رو ببین و هرجایی سوال داشتی بپرس، به محض اینکه سوال رو ببینم جواب میدم

    • @amirabbas667
      @amirabbas667 ปีที่แล้ว

      @@DevEmpower ممنون من همین زیرنویس انگلیسی منظورم بود بیشتر مباحث رو متوجه شدم تا جایی که دیدم
      حتما سوالی بود میزارم 🙏

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว

      @@amirabbas667 عزیزی, زیرنویس انگلیسی که اتوماتیک خود یوتیوب جنریت میکنه, یه دکمه اون بالا هست cc اونو بزنی فعال میکنه, امیدوارم ویدیوی مفیدی باشه

    • @amirabbas667
      @amirabbas667 ปีที่แล้ว

      اگر امکانش بود policy based هم بزارید

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว

      @@amirabbas667 انشالله در آینده حتما سعی میکنم بزارم

  • @nguyễntrung-g4g
    @nguyễntrung-g4g 10 หลายเดือนก่อน

    40:10

  • @mahdi4581
    @mahdi4581 ปีที่แล้ว

    من خودم زبانم خوب نیست ولی پیشنهاد می کنم رو زبانت بیشتر کار کن .

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว

      مرسی از پیشنهادتون، حتما همین کارو میکنم

  • @LouisGheysens
    @LouisGheysens ปีที่แล้ว

    Great!

    • @DevEmpower
      @DevEmpower  ปีที่แล้ว

      Thank you my friend