I have an Angular app that uses Okta to manage user logins and connects to an ASP.NET Core Web API. The Angular app sends the Okta auth token along with all API requests. The API is meant to validate the auth token before processing the request and extract the uid.
I followed the directions on the Okta Dev website here:
https://developer.okta.com/docs/guides/validate-access-tokens/dotnet/main/#validate-a-token
On my dev machine, everything works perfectly. However, once the API is deployed to Azure, this line in the ValidateToken
method fails every time:
var discoveryDocument = await configurationManager.GetConfigurationAsync(ct);
The authorization server passed into the confiurationManager
and the Azure server both share the same domain, so I don't think there would be a firewall or proxy issue. Has anyone else had similar issues with the GetConfigurationAsync
method, and if so, how did you solve it?
I found my answer here: https://stackoverflow.com/a/58784678/1943644
Enabling TLS 1.2 solved the issue
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
Putting that in the ConfigureServices
section of Startup.cs
solved the problem.