
VaidehiP.83594 (Customer) asked a question.
I’m experiencing a similar issue to what is discussed in
The Okta.AspNetCore version that I am on is 4.6.1
Here’s the piece of code I have to get user details. While I do receive the user details, I also encounter the above exception, which seems to bypass but still gives me the result.
var oktaConfig = new Configuration()
{
Token = configuration[“OktaToken”],
OktaDomain = configuration[“OktaDomain”],
};
UserApi = new UserApi(oktaConfig);
var user = UserApi.GetUserAsync(“test.user@test.com”).Result;
var name = user.Profile.DisplayName;
Has anyone found a solution for this issue? Any guidance would be greatly appreciated!
ERROR
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);
SDK Info
Okta.AspNetCore version is 4.6.1
Okta.Sdk version tried 9.1.1 (Older version also have same issue)
Okta.Auth.Sdk version is 2.0.5
.NET version 6.0 (upgraded from .net4.8 to .net6.0)
OS: Windows
Project Template used: any template but currently using .NET Core.
IDE: Visual Studio 2022

Hello @VaidehiP.83594 (Customer) Thank you for posting on our Community page!
This question is more appropriate for our dedicated Okta Developer Forum.
My advice would be to reach out via devforum.okta.com to take advantage of their expertise.
While we'll do our best to answer all of your questions here, this medium is more inclined towards Okta core products and features (non-developer work).
Thank you for reaching out to our Community and have a great day!
--
Help others in the community by liking or hitting Select as Best if this response helped you.
The new Okta Help Center YouTube channel is your go-to resource for tips, troubleshooting, and best practice videos. Subscribe today.
Thanks for responding to the post. We have already reached out to devforum.okta.com<http://devforum.okta.com/>.
Here is the link: https://devforum.okta.com/t/problem-with-getconfigurationordefault-method-in-okta/30937/2
But they closed the topic without any response. Will you be able to provide insight on this forum ticket?
Thanks,
Vaidehi