I have these two methods in my xamarin.form application. I have added b2c authentication to my app. now how can I change these methods to use token. sorry if this is very basic question but i am so junior. thanks
private static async Task<string> SendGetRequest(string url)
{
var httpClient = new HttpClient();
string responseString = string.Empty;
var response = await httpClient.GetAsync(url);
if (response.IsSuccessStatusCode)
{
responseString = await response.Content.ReadAsStringAsync();
}
else
{
...
}
return responseString;
}
private static async Task SendPostRequest(string url, object payLoad)
{
try
{
var httpClient = new HttpClient();
var stringContent = new StringContent(JsonConvert.SerializeObject(payLoad), Encoding.UTF8, "application/json");
var response = await httpClient.PostAsync(url, stringContent).ConfigureAwait(false);
if (!response.IsSuccessStatusCode)
{
...
}
}
catch (InvalidOperationException ex)
{
...
}
catch (Exception ex)
{
...
}
}