Тёмный
No video :(

ASP.NET Core Authentication with JWT (JSON Web Token) 

DotNet Core Central
Подписаться 27 тыс.
Просмотров 162 тыс.
50% 1

Опубликовано:

 

21 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 282   
@this-is-bioman
@this-is-bioman Год назад
That's how a tutorial should look like! Straight to point with a working example. Love it! 😎🤩
@DotNetCoreCentral
@DotNetCoreCentral Год назад
Thanks!
@ProperComment
@ProperComment 3 года назад
Why wasn't I able to find this channel earlier 😭 🤣🤣 I've shared your content with all my colleagues 🙏
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@The Red Baron, thanks for watching. I hope everyone you have shared with will find it useful.
@drakZes
@drakZes 3 года назад
Easy and great setup of how to add authorization to a web application. Well done!
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Francois Smit, thanks for watching!
@darizardTheDargon
@darizardTheDargon 2 года назад
Add my voice to the chorus. Insanely helpful and well-done video, thank you.
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
Thanks!
@naveen.bhardwaj
@naveen.bhardwaj 2 года назад
Awsm Explanation, Easy to understand
@junaidm1038
@junaidm1038 3 года назад
This is the most simple way of doing JWT , thanks so much
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@junaid m, thanks for watching!
@R2d2ums
@R2d2ums 3 года назад
Dude!! Thx for the video! It really helped me out. Right know I'm just reading your blog to understand better the whole code.
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Carlos Daza, thanks!
@Ram-yk7yl
@Ram-yk7yl 3 года назад
This worked like a charm. Exactly what I was looking for..., Confused with various online material, but this was most clear of all of them...
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Ra m, thanks for watching the video, and glad this video helped you!
@davidemmanuel3001
@davidemmanuel3001 3 года назад
God bless you my friend for this video
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@DAVID EMMANUEL, thanks for watching!
@avtarsashia4897
@avtarsashia4897 3 года назад
Awsome way of teaching. And working with real scenario.
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Avtar Sashia, thanks for watching!
@mmsky
@mmsky 3 года назад
Thank you so much for taking the time to make this video and share your knowledge! Excellent. Subscribed :)
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Monica S, thanks for watching!
@kiranbs5057
@kiranbs5057 3 года назад
Nice video , But I feel it would have been been great for beginners like me , if you had spent some time explaining the usage of each line while configuring authentication in startup and controller class files .
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Kiran BS, thanks for watching, and thanks for your valuable feedback, I will surely keep this in mind.
@ghkpr
@ghkpr 3 года назад
Great tutorial, easy to follow and understand. Thanks a lot!
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@gh057k33p3r, thanks for watching the video!
@funnytoddler375
@funnytoddler375 2 года назад
Nice explanation 👌
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
@Funny Toddler, thanks!
@DevKumar-nh6vk
@DevKumar-nh6vk Год назад
Love the video. I urge you to create video on OAuth with JWT implementation. Complete details on OAuth.
@DotNetCoreCentral
@DotNetCoreCentral Год назад
Thanks, will do!
@vigneashselvaraj3592
@vigneashselvaraj3592 11 месяцев назад
Excellent content.. very straight forward
@DotNetCoreCentral
@DotNetCoreCentral 11 месяцев назад
Thanks!
@PraveenKumar-ft2kr
@PraveenKumar-ft2kr 3 года назад
Excellent video brother.. I have been looking for this.. Thank you so much 🙏🙌👏👏
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Praveen Kumar, thanks for watching!
@evaapperson1760
@evaapperson1760 2 года назад
Very quality content. It very helped me to understand this important theme !:)
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
@Eva Apperson, thanks for watching!
@brettgregory3622
@brettgregory3622 2 года назад
Amazing video thank you! So clear and concise!
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
@Brett Gregory, thanks for watching!
@nirbhaysinghverynice5880
@nirbhaysinghverynice5880 Год назад
really nice explanation to the point and explained every point thanks alot
@rdoskoch
@rdoskoch 2 года назад
So satisfying keyboard typing.))))
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
@Roman Doskoch, thanks!
@RahulKumar-tf3cx
@RahulKumar-tf3cx 2 года назад
Thank you Nirjhar. Great explanation.I have implemented with your example
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
@Rahul Sharma, thanks for watching!
@STUPIDYOUTUBE_HIDINGMSGS
@STUPIDYOUTUBE_HIDINGMSGS 2 года назад
your tutorial is amazing, the IT community needs more people like you! however, MICROSOFT SUCKS for implementing a million different classes and ways to implement authentication /authorization classes then those classes get deprecated and then the developer will be scrambling for answers to solutions that new core version/framework is trying to introduce! For MS, there is no one universal, non-complex, non-confusing way to create a simple web API with basic authentication, it's like each authentication scheme is created by one developer that is trying to out-do the other developer within their team that has implemented a recent class/code! I hope, I really, really hope, that MS should one day be overtaken by another company or that incoming new developers will instead switch to open source and other tech stacks for web api-related stuff! I will be the first to rejoice if MS will file for bankrupcy one day, or get bought by Apple!
@pankitpatel1987
@pankitpatel1987 4 года назад
good help full, if you want to add more things then add authorization with multiple roles, multi-tenant application authentication.
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
Thanks for the suggestion!
@inmywaythings
@inmywaythings 2 года назад
Simple and clear example, thank you 👍
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
Thanks for watching!
@Imran-mr6fv
@Imran-mr6fv 3 года назад
Excellent... keep up the good work
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Abc Xyz, thanks for watching!
@iyashasgowda
@iyashasgowda 3 года назад
A heartly thanks to you for teaching the tokenization in simple way.
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Yashas Gowda, thanks for watching!
@gautamsaraswat1541
@gautamsaraswat1541 4 года назад
Great video. Keep doing the good work
@DotNetCoreCentral
@DotNetCoreCentral 4 года назад
Gautam Saraswat thanks for watching!
@nileshmore1820
@nileshmore1820 2 года назад
Very good explanation. thank you .
@Whisper_Jonas
@Whisper_Jonas 2 года назад
Thank you for all of your tutorial
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
@Monsieur Bobel, thanks for watching!
@alibux
@alibux 3 года назад
Thank you for this very helpful video and sharing your knowledge! Subscribed!
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Rehan Alibux, thanks for watching the video and subscribing to my channel!
@ashutoshmishra2170
@ashutoshmishra2170 3 года назад
i am big fan of your videos .
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Ashutosh Mishra, thanks for watching!
@knightmarerip711
@knightmarerip711 3 года назад
Excellent work explaining this!
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Knightmare RIP, thanks for watching!
@sanderconstantin2016
@sanderconstantin2016 2 года назад
Great video. Truly helped me out!
@pritamdeokule
@pritamdeokule 2 года назад
Thanks You. Great... very neat and clean explanation given by you.
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
@Pritam Deokule, thanks for watching!
@amjster
@amjster 2 года назад
Excellent video, I have shared with my whole team to watch. Thank you. One question, at 15:56 you add the JwtTokenAuthenticationManager to services with the key, but what if you wanted to pass in the DbContext and also maybe the ILogger so the JwtTokenAuthenticationManager can confirm the credentials against the Db. How do you configure the services for the JwtTokenAuthenticationManager in startup to inject those into the class?
@pedromoura8731
@pedromoura8731 4 года назад
Hi, thanks for the tutorial! You keep the content simple and easy wich is great, but for future improvement you could add a real front end, just a login page, 1 or 2 authorized pages and a logout. this way we could see the complete workflow of the jwt and how is stored in page transitions.
@DotNetCoreCentral
@DotNetCoreCentral 4 года назад
Pedro Moura thanks for the suggestions. I’ll definitely work on that. Thanks again for watching the video.
@marrelicious6731
@marrelicious6731 2 года назад
@@DotNetCoreCentral Did you ever make this video?
@lengoctuan5217
@lengoctuan5217 2 года назад
@@DotNetCoreCentral Did you ever make this video?
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
@@lengoctuan5217 no, I never got to it.
@lengoctuan5217
@lengoctuan5217 2 года назад
​@@DotNetCoreCentral Thanks brother for the reply. Your video is very helpful.
@SohailKhan1981
@SohailKhan1981 3 года назад
Very well explained. Thanks for your effort.
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Sohail Sarwar, thanks for watching!
@eryogeshtripathi8888
@eryogeshtripathi8888 3 года назад
Nice and simple video
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Yogesh Tripathi, thanks for watching!
@vinayakkatti4028
@vinayakkatti4028 3 года назад
Very useful information. Thank you sir...
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Vinayak Katti, thanks for watching!
@codewithsakti8197
@codewithsakti8197 6 месяцев назад
Thanks . Perfect video
@DotNetCoreCentral
@DotNetCoreCentral 6 месяцев назад
You're welcome!
@stephenviswaraj7463
@stephenviswaraj7463 3 года назад
Excellent Show, thanks much.
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Stephen Viswaraj, thanks for watching!
@SoftwareMahima2024
@SoftwareMahima2024 2 года назад
Very good video
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
@Raj Raj, thanks for watching!
@hindachokri5463
@hindachokri5463 3 года назад
Thank you for this helpful video. Keep doing the good work.
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Hinda Chokri, thanks for watching and taking the time to provide a comment!
@aditisen20
@aditisen20 2 года назад
very well explained
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
Thanks!
@sri3884
@sri3884 2 года назад
Great content 👏👏 , Thank you
@georgetuccio6053
@georgetuccio6053 2 года назад
Very nicely done. Thank you.
@sps014
@sps014 2 года назад
Great video, nicely explained
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
@Shivendra P. Singh, thanks for watching!
@cheequsharma7391
@cheequsharma7391 Год назад
Thanks a lot for such content. I respect and really admire your huge efforts, for such incredible content. God bless mate.
@DotNetCoreCentral
@DotNetCoreCentral Год назад
Thanks a ton
@rahulmathew8713
@rahulmathew8713 3 года назад
Awesome keep up the good work
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Rahul Mathew, thanks for watching!
@shsikzuhair4393
@shsikzuhair4393 2 года назад
Thanks....good explanation
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
@Shsik zuhair, thanks!
@marcotaliente4785
@marcotaliente4785 3 года назад
Thank you man, that is what i sought for
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Marco Taliente, thanks for watching, and glad this video helped you!
@AjithChanaka
@AjithChanaka 3 года назад
Thank you for making it easy understanding.
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Ajith Chanaka, thanks for watching!
@jashsudip
@jashsudip 3 года назад
really helpful to understand the jwt authentication. please make a video on refresh token also
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Sudip Jash, thanks for watching. I already have a video on refresh token on my channel.
@juliangzr4998
@juliangzr4998 3 года назад
Thank you very much! very well explained
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Julian GZR , thanks for watching!
@jvvable
@jvvable 3 года назад
Thanks for your video, a Very Good explanation. I have a suggestion. if you can list out all the dependencies that will be great.
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@jvv (vvj), thanks for watching and the suggestion!
@bhanushkaekanayake9988
@bhanushkaekanayake9988 2 года назад
This is really good. Thanks..
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
@Bhanushka Ekanayake, thanks for watching!
@jeffbreuninger7036
@jeffbreuninger7036 3 года назад
Thank you! Very helpful tutorial.
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Jeff Breuninger thanks for watching!
@kadavilk
@kadavilk 3 года назад
Great video brother. If you could explain why we are using each commend and its benefits would have been really helpful.
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Kishor Kadavil, thanks for watching and great feedback, I will work on this.
@habeebafvan5192
@habeebafvan5192 2 года назад
Awesome !!
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
@habeeb afvan, thanks!
@priyanshu4016
@priyanshu4016 3 года назад
Great video, i request you to explain the token validation parameter , and token descriptor class properties significance and what situation what value we should set may help great if you do some short video on that portion
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Web Samurai, thanks for watching, I will try to do a video for that.
@NadirFirfire
@NadirFirfire 2 года назад
v good video really helped me
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
Thanks!
@ajbotha7232
@ajbotha7232 3 года назад
Thank you this is an awesome video
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Aj Botha, thanks for watching!
@sachindeshmukh5532
@sachindeshmukh5532 3 года назад
Thank you so much for this video! it's really helpful..
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@sachin deshmukh, thanks for watching!
@neilvermeulen5283
@neilvermeulen5283 2 года назад
Nice!
@nafeeskhan8249
@nafeeskhan8249 3 года назад
Can you please provide the second part of this tutorial. It is very nice video. Awesome.
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Nafees Khan, thanks for watching! What are you expecting in the second part?
@hdjfgt
@hdjfgt 3 года назад
Thanks, great video
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@hdjfgt, thanks for watching!
@mariankurtov7003
@mariankurtov7003 3 года назад
Really helpful !
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Marian Kurtov, thank you for watching!
@Engineer_With_A_Life
@Engineer_With_A_Life 3 года назад
this is awesome.. thanks a lot!
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@ayush singh, thanks for watching!
@bergurmg
@bergurmg 2 года назад
thank you very much
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
@bergurmg, thanks for watching!
@usmansiddiqui1854
@usmansiddiqui1854 Год назад
Guys I am confused here that the implementation of JWT here is working on O Auth 2.0 mechanism or not?
@mrjamiebowman
@mrjamiebowman 3 года назад
This is great and I was able to replicate this. However, I'm wondering.. where do refresh tokens come into play?
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Jamie Bowman, refresh token comes to play when as an app you want to extend the token lifetime of the user without asking the user to enter id/pwd again for a new token after the initial token expired. The classic example will be a mobile application.
@prvs8
@prvs8 2 года назад
thank you.
@hhcruz1999
@hhcruz1999 2 года назад
I am able to generate the token. I am also getting the data without authorisation. But when I give the Authorize for the get method I get unauthorised. Could you please help me solve this issue.
@jspalding70
@jspalding70 4 года назад
Thank you for the knowledge you shared. What are the headers that I should be using with Postman?
@DotNetCoreCentral
@DotNetCoreCentral 4 года назад
In header you have to put “bearer token”
@Uzair_Anwar2299
@Uzair_Anwar2299 2 года назад
Hi. Good video. But what is the purpose of audience nd issuerence?
@finishthecarrot4493
@finishthecarrot4493 3 года назад
Thanks man.
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Finish The Carrot, thanks for watching the video!
@majichayan
@majichayan 4 года назад
Thank you for your well explained video. If possible, could you please make another video to show, secure an api with azure active directory and consume it from AAD secured react app.
@DotNetCoreCentral
@DotNetCoreCentral 4 года назад
majichayan I’ll definitely try. Thanks for the suggestion and thanks for watching.
@girijesh-mca
@girijesh-mca 4 года назад
Very nice explanation !!! Just one query I have in simple asp.net api we used Owin and OAuth to generate and validate token but I dint see OAuth implementation in Core is there any reason ?
@DotNetCoreCentral
@DotNetCoreCentral 4 года назад
OAuth can be implemented by a middleware. I do not see any reason why it cannot be. I will give it a try. I did not have the need yet, hence I did not try it yet. I will post my video after I try it out. Thanks for the question.
@girijesh-mca
@girijesh-mca 4 года назад
@@DotNetCoreCentral Thank you so much.
@ZnSstr
@ZnSstr 3 года назад
Very cool man but how the heck I explain all those classes in an interview lmao, this is like +4 h to learn how to talk about these things.
@STUPIDYOUTUBE_HIDINGMSGS
@STUPIDYOUTUBE_HIDINGMSGS 3 года назад
yeah, tha's the problem, right? we can't explain those complicated classes and a simple missed class then the authentication won't work!
@ZnSstr
@ZnSstr 3 года назад
@@STUPIDRU-vid_HIDINGMSGS problem is they ask for example how would you implement "JwtSecurityTokenHandler" and if you are a junior, unexperienced you can't give a straight asnwer, so the solution is to research about all those classes used and have an idea how they are implemented because in interviews they need one reason to not hire you.
@STUPIDYOUTUBE_HIDINGMSGS
@STUPIDYOUTUBE_HIDINGMSGS 3 года назад
@@ZnSstr This implementation and those classes are hard, even for mid-level and senior, unless they've memorized it or have coded that same code a few hundred times over and over. But who will remember those stuff now that everything changes and there's no one fixed implementation of JWT security? I think I've watched like 10 JWT security videos here in YT and every one of them is coded differently so it's very hard to remember which one works on certain implementation! I missed the times when there's not much security on web services and there's no REST or Web Api and WCF, just plain ASMX services.
@johnmagnetron3737
@johnmagnetron3737 3 года назад
Thank You!
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@John Magnetron, thanks for watching!
@ch1995
@ch1995 2 года назад
May I know the use of having the AuthenticationManager interface instead of just having a solid Class? thanks
@deepjyotyroy6676
@deepjyotyroy6676 3 года назад
Thanks for the Awesome Video. But I have a question. If I need to create a Custom Unathorized return message from any POST or GET api, what should I do ?
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Deepjyoty Roy, thanks for watching! In your scenario, you can remove the Authorize attribute and inside of each method check for User.Identity.IsAuthenticated, and based on that throw Unauthorised with you custom messages per method.
@varmasanjaym
@varmasanjaym 4 года назад
Hi, I see that the AuthenticationHandler class comes under two namespaces. - Microsoft.AspNetCore.Authentication - Microsoft.Owin.Security.Infrastructure could you please explain what factors decide the namespace I need to use.
@DotNetCoreCentral
@DotNetCoreCentral 4 года назад
@sanjay varma, Microsoft.Owin.Security.Infrastructure is the legacy namespace. If you are using ASP.Net Core 3.1 you should be using Microsoft.AspNetCore.Authentication .
@cezar007dead8
@cezar007dead8 3 года назад
Thank you!
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@cezar007dead, thanks for watching!
@BhautikDalicha
@BhautikDalicha 2 года назад
How we can achieve same thing in MVC and pass token after authentication?
@vigneashselvaraj3592
@vigneashselvaraj3592 11 месяцев назад
In this JWT is authorized when sent as header in the request. May I know how can the access token be validate as part of query string ?
@DotNetCoreCentral
@DotNetCoreCentral 11 месяцев назад
its a good practice to send token as part of header, but nothing stops you from sending token in query string, there are use cases like websocket where you might need to pass it in query string
@SaravanaKumar-bt5xn
@SaravanaKumar-bt5xn 4 года назад
Thanks for the tutorial. You are explaining the concepts very well. Could you please give some suggestions on this? What are the ways to store a JWT token securely on client side. We can use cookies or local storage. But, however someone/ anonymous will able to see the token by using some debugging tools and they can mock the same request and use it in outside of the application. How we can avoid it? Thanks.
@DotNetCoreCentral
@DotNetCoreCentral 4 года назад
Saravana Kumar I’m afraid there is not many choices for storing token securely on client side. Your best bet is local storage. But in terms of avoiding security threats keep your token expiry shorter. So that even if it’s stolen it cannot be used for a longer period.
@SaravanaKumar-bt5xn
@SaravanaKumar-bt5xn 4 года назад
@@DotNetCoreCentral Thank you so much for replying me. Will we use refresh token to overcome this issue?
@DotNetCoreCentral
@DotNetCoreCentral 4 года назад
@@SaravanaKumar-bt5xn yes, that's usually better.
@user-bi5vo2bo9f
@user-bi5vo2bo9f 3 года назад
great
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
thanks!
@jeremyolu2787
@jeremyolu2787 2 года назад
how would i get user data from token such as username ?
@shubhamshaw2360
@shubhamshaw2360 2 года назад
Hi, why did you uncheck the "Configure for HTTPS" and check "Docker enabled" option while creating the project? It'll be really helpful info if you tell us.
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
@Shubham Shaw, there is no particular reason. You can keep both enabled.
@johnnybravo8932
@johnnybravo8932 Год назад
If you configure https you will need SSL certificate. While running in localhost you can do with http.
@xinyuhou6535
@xinyuhou6535 2 года назад
Hi thank you for posting this video. I find it very helpful. I have one question regarding the authentication step though. After receiving the token with a valid username + password combination and entering it as Authorization : Bearer[whitespace]token, the Get step still throws a 401 error. Any idea of what may cause this? Thanks!
@denespapp1963
@denespapp1963 2 года назад
you can raise the logging level in the config and you can see the exact issue resulting in 401
@chandusubhakarareddysatti3569
@chandusubhakarareddysatti3569 3 года назад
Hi Thaks for the video, I have a couple of questions . can you please clarify this? 1. I got a token from the server. I just passed it to someone to use this token. he could able to access the API with the token until it expires. How can we restrict this? 2. I got a token from the server with an expiry time of 15 min. before 15 min I hit token controller and got another token with an expiry time of 15 min. Now I have two tokens with valid time. will the two tokens work? or only the latest one? if so how can we validate?
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Chandu Subhakara Reddy Satti 1. If you pass the token to someone else purposefully, there is nothing that can be done here right. Until the token expires that person will have access to your API unless you keep all tokens in storage and check against that, in which case you can flag the token. 2. It depends if you are keeping the tokens in storage, in that case, you can have an implementation of invalidating older tokens when you send out new tokens. Otherwise, both will be valid.
@ravindranaths513
@ravindranaths513 4 года назад
Hi, At timeline of 10:23 in this video, I have two questions here. 1) Why you used SecurityTokenDescriptor (from Microsoft.IdentityModel.Tokens); why not JwtSecurityToken (from System.IdentityModel.Tokens.Jwt)? 2) What is the difference between Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor and System.IdentityModel.Tokens.Jwt.JwtSecurityToken classes? When to use which?.
@DotNetCoreCentral
@DotNetCoreCentral 4 года назад
@Ravindranath S, JwtSecurityTokenHandler expects SecurityTokenDescriptor from Microsoft.IdentityModel.Tokens, hence. You can use JwtSecurityToken to create token, in that case, you will need to call WriteToken, instead of CreateToken on the JwtSecurityTokenHandler instance.
@RameshKumar-so8lp
@RameshKumar-so8lp 3 года назад
how to validate bearer token - if you put post man bearer token its allow to hit the method i want to how to validate bearer token and the method
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
@Ramesh Kumar, in the controller you will need to do this: if (!User.Identity.IsAuthenticated) return Unauthorized(); Rest will be taken care of by the middleware.
@ravindranaths513
@ravindranaths513 4 года назад
Hi, at timeline of 11:26 in this video, you added 1 hour as expiration. I tried with 1 min. But, after 2 min also, I could able to use same token and get the data. Means: token is not expired. Could you please help me on this.
@DotNetCoreCentral
@DotNetCoreCentral 4 года назад
@Ravindranath S, I will try it out and let you know.
@umairghouri1718
@umairghouri1718 3 года назад
@@DotNetCoreCentral we have to use UseExpirationValidation in AddJwtBearer configuation
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@@umairghouri1718 thanks for the suggestion!
@shashivishw803
@shashivishw803 3 года назад
im getting 404 not found in get when im trying to get values1 and values 2
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@shashi vishw, if you can share your code in GitHub I can take a look, thanks.
@iamsidthebest007
@iamsidthebest007 3 года назад
Thanks for the video. I followed exactly like you said. The token expiry I set as : Expires = DateTime.UtcNow.AddMinutes(Convert.ToDouble("20")); So, as you see I have set 20 minutes. I submit Authenticate request -> I get access_token, thats great! Now, I submit other API request with this access_token as bearer, I get the response as expected. Now, after 20 minutes, I try hitting the same endpoint, I still get response, even though 20 minutes have passed already. What am I missing? Please help.
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@Sid N, thanks for watching. I will take a look and let you know.
@abdullahhafeez7798
@abdullahhafeez7798 2 года назад
where is the code link??
@DotNetCoreCentral
@DotNetCoreCentral 2 года назад
github.com/choudhurynirjhar/auth-demo
@tertulianeo
@tertulianeo 3 года назад
My Authorization header is missing IDK why but I don't have problems with other headers, is there a way to change the header name?
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@tertulianeo, how are you passing the header? can you share the code?
@tertulianeo
@tertulianeo 3 года назад
@@DotNetCoreCentral ty, it was a problem with my cloud front
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@@tertulianeo great to hear your issue is resolved!
Далее
ASP.NET Core Authentication with Custom Handler
20:36
Ik Heb Aardbeien Gemaakt Van Kip🍓🐔😋
00:41
JWT Refresh Token in ASP.Net Core (a deep dive)
33:13
How He Got $600,000 Data Engineer Job
19:08
Просмотров 23 тыс.
Software developers are officially cooked
8:57
Просмотров 26 тыс.