Currently developing an ASP.Net Core 6 API to be consumed from a Xamarin mobile app.
I just want to know two things :
What ASP.Net Core Web API authentication must I use? Jason Web Token (JWT) or another type of authentication suitable for Xamarin Mobile as per below image.
How do I keep (JWT) cookies authentication alive and kill it after then pass it on endpoint through to the mobile developer so they can use it and cancel it from the Xamarin app or it will be done automatically ?
How do I pass the JWT token from the ASP.Net Core API to the Xamarin App... because the Web API will be consumed from an Xamarin Mobile App.
Any idea please ?
private static async Task ProcessRepositories()
{
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/vnd.test.v3+json"));
client.DefaultRequestHeaders.Add("User-Agent", "crmsystem Repository Reporter");
var stringTask = client.GetStringAsync("https://api.crm.com/data/repo");
var msg = await stringTask;
Console.Write(msg);
}
JWT tokenwithout any hesitation its more used and secure authentication protocol now, regardingcookie authenticationyou could set token life time there. After that particular time token would be expire automatically. You could have a look here in official document