Hello all,
I been working hard on my project and its almost ready to be released into production.
Now 1 thing has just come up that i am not positive about how to handle.
I have a Front end MVC Core UI project and a back end .Net Core Web API.
My WebAPI is making an httpclient call to my UI controller that has an [authorize] attribute on it. (I know its usually the opposite way but for this circumstance it must to this)
How would I authorize my API to call this controller action?
I have cookie auth and JWT auth.
My default is cookie auth.
// API
string trade = JsonSerializer.Serialize(tradeVM);//"TraderUI"
using var client = _httpClient.CreateClient();
client.BaseAddress = new Uri("https://localhost:50111");
//using var response = await client.PostAsync($"/HarkinsTrader/GetTradeStatusUpdate/",
using var response = await client.PostAsync($"/HarkinsTrader/SendTradeStatusUpdate/",
new StringContent(trade, Encoding.UTF8, "application/json"));
if (response.IsSuccessStatusCode)
{
_logger.LogInformation("Success StreamStatus Update");
return Ok();
}
[HttpPost]
public async Task<IActionResult> SendTradeStatusUpdate([FromBody] TradeResultVM model)
{
_logger.LogInformation("Inside GetTradeStatus");