I have implemented azure ad authentication in SPA app and validating the token using OWIN start.cs. it is working fine in local environment. below code used for token validation:
app.UseWindowsAzureActiveDirectoryBearerAuthentication(new WindowsAzureActiveDirectoryBearerAuthenticationOptions
{
Tenant = tenant,
TokenValidationParameters = new TokenValidationParameters
{
//ValidAudiences = new[] { Audience },
ValidAudience = validateAudience,
ValidateIssuer = false,
ValidIssuers = new[] { ValidIssuers }
}
});
when I deployed this published code on prem server and run web api it throws error as mentioned in below screen shot. I have used Microsoft.Owin.Security.ActiveDirectory version 4.2.2.0, 

can anyone help on this ?
Basically, the error
task was canceledis expected when an HTTP request is canceled maybeif the user closes the page suddenly.or cancels before execution completes.The TaskCanceledException is mostly timeout.But to check the exception, it may have to be inspected with try catch.
you can try to suppress response if the cancellation token occurred by using
if (cancellationToken.IsCancellationRequested)If it is due to time out ,it can be set to some value.Plesae check the references.
In some cases of use ,
awaitcan be used for simultaneous tasks to be completed with async.References: