We are getting Unable “ Unable to obtain configuration from: 'https://<domain>oauth2/<appid>/.well-known/openid-configuration'”
We are getting issue while integrating OKTA SDK with our API developed in ASP.NET Core running . The error we are getting is this: System.InvalidOperationException: IDX20803: Unable to obtain configuration from: ‘https://oauth2//.well-known/openid-configuration’. —\u003e System.IO.IOException: IDX20804: Unable to retrieve document from: ‘https://oauth2//.well-known/openid-configuration’. —\u003e System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. —\u003e System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
We’ve tried few option suggested online, but nothing worked.
Net Code
authentication middleware by using Okta.Aspnetcore nuget package by following below document.
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = OktaDefaults.ApiAuthenticationScheme;
options.DefaultChallengeScheme = OktaDefaults.ApiAuthenticationScheme;
options.DefaultSignInScheme = OktaDefaults.ApiAuthenticationScheme;
})
.AddOktaWebApi(new OktaWebApiOptions()
{
OktaDomain = Configuration["Okta:OktaDomain"],
Audience = "sampleAud",
AuthorizationServerId = "xxxxxx",
});