Excellent timing - I just completed the Authentication section of your Pragmatic Clean Architecture course and wanted to learn more about this point specifically. Thanks!
Very nice video on an interesting topic. Ideas for continuing on this: write unit tests for this, write a handler that manages redirects (I think that would need to be the lowest handler, and be a different type than DelegatingHandler)
@@MilanJovanovicTech It would be for example a handler that just logs redirect links. in the case you navigate to a link provided by the user and you want to log potential redirects, when you try to download from the user provided link.
Let's say there are 3 external APIs meaning their base address, authentication process would be different and only one of them would be called based on user input. In that case how would you register them in the startup with message handlers without duplicating code? Thank you.
I have a problem with this approach, i am logging the request and response that go trough httpClient. I need a scoped Service that logs the data. The problem is that the Scoped service contains properties that are same for the httpRequest comming trough api, controllers, services and httpClients that are called within. The problem is that the scoped logging service is somehow out of scope in the DelegateHandler, i tried HttpContextAccessor, it works when the requests come from API, but the problem comes up when the httpClient is called from a background task, scoped logging service is out of scope - therefore the properties that i have are lost when called within delegation handler. How do i solve that problem, do you have an idea?
Maybe it is more naive apporach but there is also a way to nest Http Handlers within constructors; something like: var client = new HttpClient( new myHttpMsgHanlder_1( new myHttpMsgHanlder_2( new HttpClientHandler() ) )); how do you see it?
Hmmmm......i was getting a bit of déjà vu as i was thinking i had seen this in a video already very recently. Nick Chapsas literally had a video talking about this 4 days ago....maybe its a coincidence 👀
I hope one day videos with goofy faces on thumbnails attract less clicks so that trend can go away. This is a programming channel, do these types of viewer's even click more from that?
Then you're hoping for human psychology to go away, and well... that isn't really happening. 😅 What does it matter anyway? The content is what's important. If you like it, you'll watch it. If not, you'll stop watching.
@@MilanJovanovicTech Well my comment is a sign that its resulted in me thinking about and focusing on your thumbnail enough to comment about it, so if that's a positive thing for the channel due to the additional engagement, then I suppose there is no incentive for change. But I will say cringe titles/thumbnails can be polarizing.
@@altkev Okay, but does the content deliver on the value? Because if it doesn't, I'm doing something wrong. My other option is doing "normal" thumbnails and getting 30-50% less views. :( TH-cam is saturated. Right now, there isn't any other way to stand out. P.S. You may want to skip next Friday's video. Quite an awesome thumbnail if I may say so myself, but probably not to your taste. 😅
@@MilanJovanovicTech 30-50% less views just by not putting your face on there is extreme. Well regardless of my personal tastes and desire to comment on it, you should certainly do what you need to for your channel's success. My comment was more of a commentary that it is unfortunate that such strategies have to be used in the first place.
Excellent timing - I just completed the Authentication section of your Pragmatic Clean Architecture course and wanted to learn more about this point specifically. Thanks!
Awesome, glad this was helpful to add more details 🔥
Want to master Clean Architecture? Go here: bit.ly/3PupkOJ
Want to unlock Modular Monoliths? Go here: bit.ly/3SXlzSt
Very nice video on an interesting topic. Ideas for continuing on this: write unit tests for this, write a handler that manages redirects (I think that would need to be the lowest handler, and be a different type than DelegatingHandler)
Where would we be redirecting? 🤔
@@MilanJovanovicTech It would be for example a handler that just logs redirect links. in the case you navigate to a link provided by the user and you want to log potential redirects, when you try to download from the user provided link.
this is brilliant. I was wondering if you could help me explain when we should use transient, scope, and singleton in DI for the practical case?
Transient - stateless and lightweight services
Scoped - one instance per scope (an HTTP request is a scope)
Singleton - one instance per app
Clean thumbnail, really good content.
You like the thumbnail? I started working with an editor
Why is this better than doing all the steps for example inside of my Function in Azure Function App? What is the upside of doing it before anything?
Reusability. Why don't we place all the ASP .NET middleware in the controller endpoint?
Thank so much Milan. I understand better this concept with your explanation.
Glad it was helpful :)
Let's say there are 3 external APIs meaning their base address, authentication process would be different and only one of them would be called based on user input. In that case how would you register them in the startup with message handlers without duplicating code? Thank you.
Create an extension method that will apply the specific message handlers. But you will still have to call that method for each HttpClient.
I have a problem with this approach, i am logging the request and response that go trough httpClient. I need a scoped Service that logs the data. The problem is that the Scoped service contains properties that are same for the httpRequest comming trough api, controllers, services and httpClients that are called within. The problem is that the scoped logging service is somehow out of scope in the DelegateHandler, i tried HttpContextAccessor, it works when the requests come from API, but the problem comes up when the httpClient is called from a background task, scoped logging service is out of scope - therefore the properties that i have are lost when called within delegation handler. How do i solve that problem, do you have an idea?
That's a design smell to me. Can this be re-implemented to consider that there is no HttpContext in the background task?
This helped me so much. What Theme are you running with?
ReSharper syntax highlighting
how to solve this : Bearer error="invalid_token", error_description="The signature key was not found" when using http client in blazor
No idea
Maybe it is more naive apporach but there is also a way to nest Http Handlers within constructors; something like:
var client = new HttpClient(
new myHttpMsgHanlder_1(
new myHttpMsgHanlder_2(
new HttpClientHandler()
)
));
how do you see it?
Still prefer using the recommended approach
Best tutorial!
Thank you!
Do you have a video about Keycloak? Interesting topic
No, I don't have a Keycloak video on the channel. However, I did cover Keycloak in the Auth section of my course. But it's not free 😅
@@MilanJovanovicTech you salesman!
did it fail after 2 times? shouldn't have been 3 times the retry instead? tks
Yes - I might've sped it up for the presentation :)
Hmmmm......i was getting a bit of déjà vu as i was thinking i had seen this in a video already very recently. Nick Chapsas literally had a video talking about this 4 days ago....maybe its a coincidence 👀
It is, I schedule my videos 2-4 weeks in front 📆📆
Thank you for your content.
Don't mention it, glad it was valuable!
👋
Title misleading where decorator pattern?
Fixed it 😁
Why cant save?
What do you mean?
I hope one day videos with goofy faces on thumbnails attract less clicks so that trend can go away. This is a programming channel, do these types of viewer's even click more from that?
Then you're hoping for human psychology to go away, and well... that isn't really happening. 😅
What does it matter anyway? The content is what's important. If you like it, you'll watch it. If not, you'll stop watching.
@@MilanJovanovicTech Well my comment is a sign that its resulted in me thinking about and focusing on your thumbnail enough to comment about it, so if that's a positive thing for the channel due to the additional engagement, then I suppose there is no incentive for change. But I will say cringe titles/thumbnails can be polarizing.
@@altkev Okay, but does the content deliver on the value? Because if it doesn't, I'm doing something wrong.
My other option is doing "normal" thumbnails and getting 30-50% less views. :(
TH-cam is saturated. Right now, there isn't any other way to stand out.
P.S. You may want to skip next Friday's video. Quite an awesome thumbnail if I may say so myself, but probably not to your taste. 😅
@@MilanJovanovicTech 30-50% less views just by not putting your face on there is extreme. Well regardless of my personal tastes and desire to comment on it, you should certainly do what you need to for your channel's success. My comment was more of a commentary that it is unfortunate that such strategies have to be used in the first place.
Thank you, this really helped me 🤎
I'm glad it was valuable!