Hi @Nishi-nishi ,
I'm using HttpRequestMessage properties property in order to pass auth type in the request so that the message habdler will generate the correct authorization heade (basic, jwt, etc...)
Is it good approach?
You can use the HttpRequestMessage properties to add the authorization header in the Asp.net core 3.1 application, it is OK. Refer to the official document: Make HTTP requests using IHttpClientFactory in ASP.NET Core.
Another thing I saw the Properties marked as Obsolet "Use options instead"
You may be viewing the latest version of the document, you can check the following screenshot, the document is for the .Net 6, but if you check the "Applies to" part, this property still applies to Asp.net core 3.1.
If you want to view the .Net Core 3.1 version document, you can change the .Net Version or see this link.
To the HttpRequestMessage.Options Property, we can see this property applies to Asp.net 5 and Asp.net 6, instead of Asp.net Core 3.1:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion