okta / okta-sdk-dotnet

A .NET SDK for interacting with the Okta management API, enabling server-side code to manage Okta users, groups, applications, and more.
Other
160 stars 100 forks source link

Sample in readme.md does not work, even after adjusting it to match latest SDK version 8.0.1 #726

Open dbloch3643 opened 4 months ago

dbloch3643 commented 4 months ago

Describe the bug?

Updated code to be

`

Configuration config = new Configuration();

config.OktaDomain = "https://dev-xxxxxxx.okta.com/";

// Configure API key authorization: API_Token

config.Token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

var apiInstance = new AgentPoolsApi(config);
var poolId = "poolId_example";  // string | Id of the agent pool for which the settings will apply
var updateId = "updateId_example";  // string | Id of the update

    try
    {
        // Activate an Agent Pool update
        var result = apiInstance.ActivateAgentPoolsUpdateAsync(poolId, updateId);
        Debug.WriteLine(result);
    }
    catch (ApiException e)
    {
        Debug.Print("Exception when calling gentPoolsApi.ActivateAgentPoolsUpdate: " + e.Message);
        Debug.Print("Status Code: " + e.ErrorCode);
        Debug.Print(e.StackTrace);
    }

`

What is expected to happen?

Should be able to construct the AgentPoolsApi.

What is the actual behavior?

` Microsoft.Extensions.Configuration.Binder.dll!Microsoft.Extensions.Configuration.ConfigurationBinder.GetAllProperties(System.Type type) Line 654

Microsoft.Extensions.Configuration.Binder.dll!Microsoft.Extensions.Configuration.ConfigurationBinder.BindNonScalar(Microsoft.Extensions.Configuration.IConfiguration configuration, object instance, Microsoft.Extensions.Configuration.BinderOptions options) Line 212

Microsoft.Extensions.Configuration.Binder.dll!Microsoft.Extensions.Configuration.ConfigurationBinder.BindInstance(System.Type type, object instance, Microsoft.Extensions.Configuration.IConfiguration config, Microsoft.Extensions.Configuration.BinderOptions options) Line 401

Microsoft.Extensions.Configuration.Binder.dll!Microsoft.Extensions.Configuration.ConfigurationBinder.BindDictionary(object dictionary, System.Type dictionaryType, Microsoft.Extensions.Configuration.IConfiguration config, Microsoft.Extensions.Configuration.BinderOptions options) Line 466

Microsoft.Extensions.Configuration.Binder.dll!Microsoft.Extensions.Configuration.ConfigurationBinder.AttemptBindToCollectionInterfaces(System.Type type, Microsoft.Extensions.Configuration.IConfiguration config, Microsoft.Extensions.Configuration.BinderOptions options) Line 302

Microsoft.Extensions.Configuration.Binder.dll!Microsoft.Extensions.Configuration.ConfigurationBinder.BindInstance(System.Type type, object instance, Microsoft.Extensions.Configuration.IConfiguration config, Microsoft.Extensions.Configuration.BinderOptions options) Line 371

Microsoft.Extensions.Configuration.Binder.dll!Microsoft.Extensions.Configuration.ConfigurationBinder.BindCollection(object collection, System.Type collectionType, Microsoft.Extensions.Configuration.IConfiguration config, Microsoft.Extensions.Configuration.BinderOptions options) Line 502

Microsoft.Extensions.Configuration.Binder.dll!Microsoft.Extensions.Configuration.ConfigurationBinder.BindInstance(System.Type type, object instance, Microsoft.Extensions.Configuration.IConfiguration config, Microsoft.Extensions.Configuration.BinderOptions options) Line 396

Microsoft.Extensions.Configuration.Binder.dll!Microsoft.Extensions.Configuration.ConfigurationBinder.GetPropertyValue(System.Reflection.PropertyInfo property, object instance, Microsoft.Extensions.Configuration.IConfiguration config, Microsoft.Extensions.Configuration.BinderOptions options) Line 666

Microsoft.Extensions.Configuration.Binder.dll!Microsoft.Extensions.Configuration.ConfigurationBinder.BindProperty(System.Reflection.PropertyInfo property, object instance, Microsoft.Extensions.Configuration.IConfiguration config, Microsoft.Extensions.Configuration.BinderOptions options) Line 261

Microsoft.Extensions.Configuration.Binder.dll!Microsoft.Extensions.Configuration.ConfigurationBinder.BindNonScalar(Microsoft.Extensions.Configuration.IConfiguration configuration, object instance, Microsoft.Extensions.Configuration.BinderOptions options) Line 235

Microsoft.Extensions.Configuration.Binder.dll!Microsoft.Extensions.Configuration.ConfigurationBinder.BindInstance(System.Type type, object instance, Microsoft.Extensions.Configuration.IConfiguration config, Microsoft.Extensions.Configuration.BinderOptions options) Line 401

Microsoft.Extensions.Configuration.Binder.dll!Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(Microsoft.Extensions.Configuration.IConfiguration configuration, object instance, System.Action configureOptions) Line 135

Microsoft.Extensions.Configuration.Binder.dll!Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(Microsoft.Extensions.Configuration.IConfiguration configuration, object instance) Line 115

Okta.Sdk.dll!Okta.Sdk.Client.Configuration.GetConfigurationOrDefault(Okta.Sdk.Client.Configuration configuration) Line 864

Okta.Sdk.dll!Okta.Sdk.Api.AgentPoolsApi.AgentPoolsApi(Okta.Sdk.Client.Configuration configuration, Okta.Sdk.Client.IOAuthTokenProvider oAuthTokenProvider, System.Net.WebProxy webProxy) Line 398

ConsoleApp1.dll!ConsoleApp1.Program.Main(string[] args) Line 18 `

Reproduction Steps?

Install 8.0.1 SDK Reference the Okta.Sdk.Api and Client include the code from above (with correct URL and API token)

Additional Information?

Seems to be erroring out when going through the Servers property for the default configuration.

.NET Version

project is targeted to .Net 6

I have 8.0.302 installed.

SDK Version

8.0.1

OS version

BuildNumber: 22631
Caption: Microsoft Windows 11 Enterprise
OSArchitecture: 64-bit
Version: 10.0.22631

laura-rodriguez commented 4 months ago

Thanks for reporting this issue @dbloch3643 ! Our team will review it and prioritize it accordingly.

Internal Ref: OKTA-745546

dbloch3643 commented 3 days ago

Any update on this?