Unable to convert Resource to anything with OktaClient.GetAsync<T>

I am trying to obtain Application Users using the Okta SDK for .NET. Snippet of my code is

OktaClient oktaClient = new OktaClient(new OktaClientConfiguration
{
                OktaDomain = "...",
                Token = "..."
});

var result = oktaClient.GetAsync<**AppUser**>("/api/v1/apps/.../users");

I would get the exception where the Okta.Sdk.Resource failed to parse as it is an array. I would try List but that would result in another error stating that it failed to convert from Resource to List.

How would I use this GetAsync? What would be T? Thanks in advance!

1 Like

I’m having issues calling GetAsync() as well. I can make calls like this:

public static async Task<Okta.Sdk.IUser> GetCurrentUser(OktaClient client)
{
    Okta.Sdk.IUser u = await client.GetAsync<Okta.Sdk.User>(new HttpRequest { Uri = "/api/v1/users/me" });
        return u;
}

But when I try to use List or IEnumerable I can’t get to anything that works:

public static async Task<IEnumerable<Okta.Sdk.IGroup>> GetUserGroups(OktaClient client, string identity)
{
    string uri = string.Format("/api/v1/users/{0}/groups", identity);
    IEnumerable<Okta.Sdk.IGroup> g = await client.GetAsync<IEnumerable<Okta.Sdk.IGroup>>(new HttpRequest { Uri = uri });
    return g;
}

Any help is appreciated!