I have mvc client application which uses identity server 4 using cookie authentication.
Below is my Config:
services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
Http Client Method:
public async Task<IList<MenuModel>> GetMenusNavAsync()
{
var response = await _httpClient.GetAsync("api/Menu/GetMenusNavBar");
response.EnsureSuccessStatusCode();
using var responseContent = await response.Content.ReadAsStreamAsync();
return await JsonSerializer.DeserializeAsync<List<MenuModel>>(responseContent);
}
Now i need to send access token to api controller inside http client. How to get the access token from Identity server or Coockie. Pls suggest..Thanks in advance