Problem with GetConfigurationOrDefault Method in Okta

Thanks for posting this. I’m having the same problem. My code is the same as yours, and it was based on sample code I found in the forums.

When I run the solution, Visual Studio breaks at the GetAllProperties() method inside ConfigurationBinder.cs because type is null. I can continue through the errors and it will eventually run, however I’m not sure if the results are accurate.

System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Microsoft.Extensions.Configuration.Binder
StackTrace:
at Microsoft.Extensions.Configuration.ConfigurationBinder.GetAllProperties(Type type) in /_/src/libraries/Microsoft.Extensions.Configuration.Binder/src/ConfigurationBinder.cs:line 654

Furthermore, the calling line in the OKTA SDK is Okta.Sdk.Client.Configuration.cs, Line 594, GetConfigurationOrDefault().
That line reads:
configurationBuilder.Build().GetSection("okta").GetSection("client") .Bind(configuration);

The line that calls that is line 39 in Okta.Sdk.Api.UserApi():
configuration = Okta.Sdk.Client.Configuration.GetConfigurationOrDefault(configuration);

I can consistently reproduce this so if any OKTA dev wants to reach out, I’ll be glad to help.

.NET 8.0
OKTA SDK: 8.0.1