Secure a .NET Core API with Bearer Authentication

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ก.พ. 2020
  • In this step by step tutorial, I show you how to secure a .NET Core API with JWT Bearer Authentication, using Azure Active Directory as the Identity and Access Management Layer. I also show you how to write a “secure” API client to call and authenticate to the secured API endpoint.
    We use the Microsoft.Identity.Client and Microsoft.AspNetCore.Authentication.JwtBearer packages amongst others.
    Level: Intermediate
    Code on GitHub: github.com/binarythistle/S03E...
    Companion Article: dotnetplaybook.com/secure-a-n...
    My Book: www.apress.com/gp/book/978148...
  • วิทยาศาสตร์และเทคโนโลยี

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

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

    I'm going to keep the track on this season, great series of tutorials. Awsome job man, just awsome!

  • @ptry1000
    @ptry1000 2 ปีที่แล้ว

    This is really great. I watched about a million videos and blogs and all are talking bits and pieces but couldn’t get a complete picture. This session gave me the whole picture and finally I am able to successfully build a system for my purpose. Great explanations. Really loved !!!!

  • @blinkskaterkc
    @blinkskaterkc 4 ปีที่แล้ว

    After searching for many many hours on this topic, with no luck, I came across this video. You explained things clearly and made a lot of sense out of a confusing topic. Many thanks!!

  • @ayushjoshi2367
    @ayushjoshi2367 3 ปีที่แล้ว

    By far, the best tutorial on authentication. Thank you so much for this amazing tutorial.

  • @HenryTsang
    @HenryTsang 4 ปีที่แล้ว +5

    Love your teaching style, very realistic and practical explanation. Thanks very much for making this video, you have demystified the Bearer Authentication a great deal

  • @snowke5095
    @snowke5095 3 ปีที่แล้ว

    Thank you for putting this video together. This was especially relevant to something I am working on now and helped clarify a topic I was finding otherwise confusing when trying to read through the documentation. This video made is simple and straightforward. I've liked and subscribed, thank you again!

  • @CognatioBestia
    @CognatioBestia 4 ปีที่แล้ว

    Great video! I'm a Sr Software Engineer (and manager) and found a lot of value in your video. Explained everything very well! Thanks for sharing!

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

    Absolutely love the way you've explained all of this. I've been googling, watched other videos, tutorials, but nothing comes even close to what you've done here. Cannot thank you enough!

    • @richarddufour
      @richarddufour 2 ปีที่แล้ว

      Would love for you to have a video on setting up an Azure WebApp running behind an Azure Front Door.

  • @JonOvereem
    @JonOvereem 4 ปีที่แล้ว +9

    Thank you for explaining everything so clearly. I’ve been wanting to learn this for a long time. Since I started watching your videos it finally starts to make sense to me.

    • @nicholasmohammad6961
      @nicholasmohammad6961 2 ปีที่แล้ว

      I dont mean to be offtopic but does someone know of a trick to log back into an Instagram account??
      I stupidly lost my login password. I would appreciate any tricks you can offer me.

  • @Ajmal_Yazdani
    @Ajmal_Yazdani 4 ปีที่แล้ว +5

    Les Jackson Sir. You save my lot of time. This is exactly what I have assigned to do. Superb!!!

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

    Les Jacson σε ευχαριστούμε που υπάρχεις και μας δίνεις τόσες χρήσιμες συμβουλές!!

  • @soucianceeqdamrashti8175
    @soucianceeqdamrashti8175 4 ปีที่แล้ว

    I went through all the steps. Wounderfully explained! Keep up the hard work!

  • @svetlin2010
    @svetlin2010 3 ปีที่แล้ว

    The best video ever. Very well explained. What is missing is additional video in case you have swagger and you need to be able to test the API using AAD.

  • @schoesa
    @schoesa 4 ปีที่แล้ว

    Awesome video, best teacher I have ever seen. Now I understand that whole bunch of Azure AD authentication via JWT Bearer Token in only 60 minutes. Thumbs up :-)

  • @randomvideos9444
    @randomvideos9444 4 ปีที่แล้ว

    Wow! How easily you have explained this complicated topic. Thanks for sharing this video.

  • @manishjawarkar84
    @manishjawarkar84 3 ปีที่แล้ว

    The Key things in your Videos are Very well explained, Practical usage and content oriented. Thank you so much for sharing your knowledge.

  • @SpoderSuperhero
    @SpoderSuperhero 3 ปีที่แล้ว

    This is honestly the best .NET Core channel out there.

  • @naveenpatel8039
    @naveenpatel8039 2 ปีที่แล้ว

    I found a lot of value in this video and the way it is explained is very impressive! Great video. Loved it

  • @jeffpetrie5191
    @jeffpetrie5191 4 ปีที่แล้ว

    Ok, Les, you got me! I spent 2 days on your 3 hr. API video and transferred all that knowledge to my big project, works Great! Now adding the tokens. Lots of little bumps that force a good developer to understand their environments, like sometimes VS Code just gets lost and you have to restart it, all good. I love your stuff is CURRENT! 2017 is ancient times in technology;-) Enjoy the wine, wish I could deliver it personally and share a bottle to thank you. I think that would be a riot! Keep going and good luck! Oh yes, you should get yourself a green screen;-)

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

    That is a great video tutorial. Thanks for explaining everything in a detailed manner. Looking forward to seeing more videos from you.

  • @byuidan
    @byuidan 4 ปีที่แล้ว

    First time seeing your videos... subscribed to your channel in the middle of watching the video. Great content and great delivery! I'll look through to see some of your other titles and look forward to what you do in the future. Thanks for the great work.

  • @duck1girl
    @duck1girl 3 ปีที่แล้ว

    Thank you so much. I have taken up learning about securing an Api and this video was a great beginning.

  • @rakeshchauhan-op8qw
    @rakeshchauhan-op8qw 3 ปีที่แล้ว

    46:50 - music got me off the edge of my seat. The suspension was intense. Good video btw Les

  • @jono261970
    @jono261970 4 ปีที่แล้ว

    Fantastic video - it's nice to follow a video through to the end and everything works! - I added the token to Postman and received a status 200 OK - looking forward to S3 E2 - thanks!

  • @sandipkurwale5050
    @sandipkurwale5050 4 ปีที่แล้ว

    Thank you so much ... i loved it .. tried the same with Azure CLI since I wasn't having an access to Azure AD ... had a hard time with command line but now i can relate this stuff and search for precise Azure CLI commands ... Thanks again..

  • @sebastianayalavalderrama3269
    @sebastianayalavalderrama3269 3 ปีที่แล้ว

    Thank you Les for your time. I was getting crazy until I saw your video with the resourceId "/.default" . I missed this part. Thank you.

  • @ivanpesenti202
    @ivanpesenti202 4 ปีที่แล้ว

    Hi Les,
    thank you for your time and for sharing with us this video 🤞

  • @stephenholmes7585
    @stephenholmes7585 4 ปีที่แล้ว

    Super informational video. Followed it along in VSCode and although I had some issues in Azure (Granting API access was greyed out), it all worked and I can say I learned something very useful! Thanks for sharing!

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

    Great video Les....I have been following your videos and found them extremly crisp and to the point without rushing in....It would be great if you did video on a production quality code for a small microservice app which would include Authentication / Authorization, Unit Testing etc. I know it might be a long video, but still it might be of great help...Thanks for your effort mate...

  • @masimbagndadzibaya3616
    @masimbagndadzibaya3616 2 ปีที่แล้ว

    Thank you so much man, you just tabledout a lot for most of us. Awesome video

  • @JitendraGupta-lc6de
    @JitendraGupta-lc6de 4 ปีที่แล้ว

    Thank you Les. This is really very helpful video and you explained every step very well . I was very much confused regarding this azure active directory steps . Now understand very well. I would love to watch your more videos.Thank you again.

  • @hetallcc
    @hetallcc 3 ปีที่แล้ว

    Hi Les,
    Just wanted to say thank you for making this video. This what i need to figure it out the Authentication flow on Azure Ad.

  • @matchchow7648
    @matchchow7648 3 ปีที่แล้ว

    It's a very excellent video to explain such complicated topic and used the easiest way to demo how to achieve most of requests as we have to make sure them running in demon mode! thanks!

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

    Pretty neat explanation in layman terms and been searching for this kind of video...thank you so much.

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

    [EDIT] - I forgot to say thank you for the video, extremely useful indeed!
    17:25 Regarding your advice not to use appsettings.json for production use. I can appreciate that there is a need to be careful with this during development: the application is on your local machine along with the appsettings.json file which reveals security critical information. And you certainly wouldn't want to commit that to git or any other version control.
    But once you've deployed to your production environment I feel like it's pretty safe to use appsettings.json. This is because the file is then on the server (be it Azure or somewhere else). Nobody else has access to it. And, if they do, it means they already have control of your server and therefore the security has already been compromised.
    So on local machine: be careful with appsettings.json as it contains secure information.
    On production (deployed to server): appsettings.json is OK.
    Do you disagree?

  • @fazilb195
    @fazilb195 4 ปีที่แล้ว

    Wow this is awesome.. it'd be really helpful if you could make a series on this topic with other types of clients too. Loved it Les. Thank you so much

  • @josephcorbett7805
    @josephcorbett7805 3 ปีที่แล้ว

    Thanks for putting this together! It really helped clarify a lot of things for me.

  • @starman9000
    @starman9000 3 ปีที่แล้ว

    Very Satisfying video! content cleared laid out! I enjoyed and learned thoroughly! Best tutorial better than Udemy and Plural sight content! Thank you, Subscribed!!

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

    Watch out on minute 31. Azure added an extra field when creating a client secret. Make sure you copie the value and not the ID!!
    Super video thank you so much.

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

    It's October 2022 but for me it's still the best free material about a practical approach to learn authentication in .NET on the internet.
    Great job. Congratulations and thank you!

    • @vipinsingh-ji8dj
      @vipinsingh-ji8dj 2 หลายเดือนก่อน

      Which channel best for paid version?

  • @azer6849
    @azer6849 3 ปีที่แล้ว

    Thank you, Les, I would like to express my gratitude for your excellent video, and god bless you.

  • @runek75
    @runek75 3 ปีที่แล้ว

    I immediately hit subscribe just by looking at the shelf in the background :) my kinda guy. Pluss, ofcourse, the content seems spot on for me (after 5 minutes in)

  • @vikass1078
    @vikass1078 2 ปีที่แล้ว

    Excellent tutorial. Thanks a lot for demonstrating the practical approach.

  • @soucianceeqdamrashti8175
    @soucianceeqdamrashti8175 4 ปีที่แล้ว

    Like your videos and style a lot! Will for sure buy your book in the near future! Thanks for the awesome material!

  • @bobbykaruturi2300
    @bobbykaruturi2300 3 ปีที่แล้ว

    Awesome step by step tutorial for authenticating .Net core API.

  • @parthgoyal8322
    @parthgoyal8322 3 ปีที่แล้ว

    So beautifully explained and coded. Thank You for making such stuff

  • @rossthemusicandguitarteacher
    @rossthemusicandguitarteacher 3 ปีที่แล้ว

    You are a complete champion my friend, thanks!

  • @cycostallion
    @cycostallion 3 ปีที่แล้ว

    Fantastic!!
    This was a great tutorial coupled with lucid explanation.

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

    Thank you so much for sharing your knowledge on this channel.
    You made me a wise man :-)

  • @DavidEvans-uj3uw
    @DavidEvans-uj3uw 3 ปีที่แล้ว +2

    Another great video from Les. I enjoy his teaching style and clear explanations. But I had to ditch this approach for securing the API I'm building because I cannot see how to set up user roles with this approach. I'm probably missing something simple, but it's throwing me for a loop. I would love to see a video showing how to set up user login and adding user role claims to the JWT token in Azure.

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

    Watching your video like some rocking movies....Great mate!

  • @csalgo7345
    @csalgo7345 3 ปีที่แล้ว

    Greatest .net core tutorial out there!

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

    Thank you so much Les!!. Excellent!1 Real world problem and you covered it perfect. Easy to understand.

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

      Cool glad it helped you out! Cheers, Les

  • @yajuvender99
    @yajuvender99 3 ปีที่แล้ว

    Superb Video Les!! Thank you soo much for explaining in detail.

  • @sssshooter
    @sssshooter 3 ปีที่แล้ว

    Thank you so much for this tutorial, very well explained it helped me a lot.

  • @kennygilmore1057
    @kennygilmore1057 3 ปีที่แล้ว

    I really enjoyed the video! Great job and VERY helpful.

  • @SagnikSaha94
    @SagnikSaha94 3 ปีที่แล้ว

    Thank for nicely explaining the concept step by step, It was crystal clear :-).

  •  3 ปีที่แล้ว

    Great channel! Thank you Les! Keep up the good work

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

    Wonderful video, very nicely explained, This was really helpful to me. Thank you.

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

    Great Video. Thanks for creating such a wonder video which is easily understandable.

  • @moshikof7778
    @moshikof7778 2 ปีที่แล้ว

    well explained, even if im not azur developer, the concepts are well explained. keep going with the good work

  • @gagwithgaffer8385
    @gagwithgaffer8385 4 ปีที่แล้ว

    Thanks Les, great video as always :)

  • @rhmirani4367
    @rhmirani4367 4 ปีที่แล้ว

    Excellent and well explained one of the complicated topic, great work!!

  • @muslehhaj4164
    @muslehhaj4164 3 ปีที่แล้ว

    Thank you very much for the amount of information that you made easy for us and that saved a lot of time, but frankly I was looking forward to seeing an illustrative example of a safe verification method for user authorization as full stack example :). We all very grateful for your efforts.
    Best Regards

  • @miklosnemeth8566
    @miklosnemeth8566 4 ปีที่แล้ว

    I am at 5:28, and I had no any info earlier, how this works, just what you show on your diagram, and scenario. Just for fun, from your diagram, I guess, the way it works is, that the JSON token is signed by one of Azure's private keys and the dot net core tool kit has the Azure's public key(s). This is how I'd implement this. I am looking for the end of the story, if I was right. Your videos are tremendously entertaining.

  • @adhivenkatesh3431
    @adhivenkatesh3431 4 ปีที่แล้ว

    Jack, it was nice explanation,and cool to understand , thanks for the video.

  • @parvkaurav7973
    @parvkaurav7973 4 ปีที่แล้ว

    Great Video. It saves me. I see a lot of implementation but they are quite complicated and not complete.

  • @ronaldabellano5643
    @ronaldabellano5643 4 ปีที่แล้ว

    I like your other videos that have broken the parts of your video, it's easy to follow because I will know what topic you're talking to that point. It's hard to watch the video for more than 15 minutes.

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

    I just finish :-)!! thank you a lot for all the tips, I really enjoy and learn with your way of teaching

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

      Hi Carolina! I'm so happy to hear that - great work! And thank you for your kind feedback. Take care, Les

    • @manishraj-it2qv
      @manishraj-it2qv 3 ปีที่แล้ว

      Hie, for me Grant permission button at 36:30 time , the button is disabled its not working can you tell me the reason

  • @xelaksal6690
    @xelaksal6690 3 ปีที่แล้ว

    Fantastic! As always.

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

    Man that was cool - I just happened to be working on exactly these implementations, great clarity, fun music.

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

      Glad it was helpful!

    • @jaydev1263
      @jaydev1263 2 ปีที่แล้ว

      @@binarythistle 25:56 you missed the "/" between the values in authority....man i was so confused for an hour that why this is not working just for me

  • @GagandeepSingh-lz5bg
    @GagandeepSingh-lz5bg 3 ปีที่แล้ว

    Les thanks for the video. It was helpful.

  • @taranjitsingh6477
    @taranjitsingh6477 3 ปีที่แล้ว

    Great job you just got a new sub
    Covered a good amount in a video while making it simple

  • @davidlingier579
    @davidlingier579 3 ปีที่แล้ว

    Nice job, thanks for sharing your knowledge! From now on "Les is more for sure".

  • @iandavies1524
    @iandavies1524 3 ปีที่แล้ว

    Great video again Les.

  • @masoodakhtar2848
    @masoodakhtar2848 3 ปีที่แล้ว

    Great job! very well explained, bit by bit..

  • @OvRaf
    @OvRaf 4 ปีที่แล้ว

    great tutorial! man, thanks so much!

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

    fantastic sir,huge fan of you

  • @jpocketvnext
    @jpocketvnext 2 ปีที่แล้ว

    Very well done, sir! Thank you!

  • @ayushojha8124
    @ayushojha8124 3 ปีที่แล้ว

    Thanks Les for amazing video !!!!!!!!

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

    Thank you so much for the crystal clear explanation. I was able to follow without any problem. Thanks once again for the great videos. Could you please do some videos on Microsoft Azure Services for Developers.

  • @Halvard1992
    @Halvard1992 3 ปีที่แล้ว

    This video is amazing. It really helped me a alot - thanks a bunch :)

  • @joaopauloantoniazzidemorae5334
    @joaopauloantoniazzidemorae5334 3 ปีที่แล้ว

    Congratulations with the great vídeo!

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

    This is fantastic. Cheers mate!

    • @binarythistle
      @binarythistle  4 ปีที่แล้ว

      My pleasure mate! Cheers, Les

  • @boebawashere
    @boebawashere 4 ปีที่แล้ว +9

    Loved this video! Good explanation, my teachers could learn a lot from u!
    I did get an error at the end: "The remote certificate is invalid according to the validation procedure".
    But I got it working by adding this code right above making the httpClient:
    HttpClientHandler clientHandler = new HttpClientHandler();
    clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; };
    The HttpClient then uses another constructer like this:
    var httpClient = new HttpClient(clientHandler);
    Thanks a lot! Subbed immediately ;)

    • @ThomasPoth
      @ThomasPoth 4 ปีที่แล้ว

      Thanks for sharing your solution.
      Imho this should be only necessary for local testing.
      BTW, thanks Les for your great work.

    • @mikeha
      @mikeha 3 ปีที่แล้ว

      I tried that, it didn't work, now I get Unauthorized back even though I did get the token

  • @rasmuskarlsson5741
    @rasmuskarlsson5741 3 ปีที่แล้ว

    Great tutorial, thanks!

  •  3 ปีที่แล้ว

    Great video! Thanks man.

  • @amitkhajuria
    @amitkhajuria 4 ปีที่แล้ว

    Thank you for nice explanation , it helped a lot...

  • @OmarNg7X
    @OmarNg7X 2 ปีที่แล้ว

    Thank you so much. You saved me.

  • @kulivers1998
    @kulivers1998 2 ปีที่แล้ว

    Greate video, thanks a lot, you have really good teaching skill

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

    Thank you very much for your videos, I'm a student as an IT Dev, and your the best teacher I could ask for.

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

      Greetings from Melbourne Maxime! Thanks for the lovely comment - I really appreciate it. Cheers, Les

  • @LakhanSINGH-rk9et
    @LakhanSINGH-rk9et 4 ปีที่แล้ว

    Thanks for such a great video

  • @melk48111
    @melk48111 4 ปีที่แล้ว

    Awesome video Les :)

  • @thesunilsun
    @thesunilsun 3 ปีที่แล้ว

    Les(s) is More, actullay ! .. Thanks again for the great video !! :)

  • @amineayachi335
    @amineayachi335 4 ปีที่แล้ว

    The best thank you for the great job that youre doing

  • @villarroelxD
    @villarroelxD 4 ปีที่แล้ว

    This is extremely usefull! thanks!

  • @aliasad8342
    @aliasad8342 3 ปีที่แล้ว

    This is awesome!

  • @happylittlemonk
    @happylittlemonk 3 ปีที่แล้ว

    Excellent video. Thanks

  • @vinothkumar9680
    @vinothkumar9680 2 ปีที่แล้ว

    Wonderful session @Les

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

    Good stuff again from Les