OKTA SDK for dotnet: call to client.Users is hanging

I am trying to make a call get all users using the okta sdk for dotNet.

I got a lot of features working using the SDK like Get User, Create User and etc,

However, when I try to get all of the users, the call just hangs.

I tried the following methods:

var allUsers = await client.Users.ToArrayAsync();
var allUsers = await client.Users.ToListAsync();
var allUsers = await client.Users.ListUsers().ToArrayAsync();

But, the system just hangs.

The documentation says: The SDK will automatically [paginate] Okta collections for you:

So, I would expect it would not get all of the users and I can some how page through them.

I have no idea what I am doing wrong. Any help would be appreciated.

And the same authorization and client instance works for the other calls you are making, such as getting a single user?

If you watch your network traffic, do you see the .NET application making API calls to https://oktaDomain/api/v1/users?

First, thanks for the reply. I appreciate it.

I have an explanation for this issue but I don’t understand the behavior or how to make it useable for my purposes.
Basically it works, but it takes a really looooooooong time to return the data. (I had to go for a walk and let it run to completion.)
We have close to 60,000 users in test. It looks as though all 60,000 are being returned.

So, my questions are:

  • The documentation on github says:

List all Users

The SDK will automatically paginate Okta collections for you:

  • So, why is paging not working automatically? Is there something I have to do?

  • How can I get paging working. I played around with the limit argument doing something like the below but it still hangs up.

var allUsers = await client.Users.ListUsers(limit: 5).ToArrayAsync();

Any thoughts would be appreciated.

The ListUsers method should be returning all the results for your query, that’s what it means when it says the SDK handle pagination for you: you shouldn’t need to do anything to ensure that all (matching) users are returned.

The limit arg will just dictate how many results per page, so more API calls will be occurring if you lower the limit to 5.

How long are you seeing this call take?

How long which one is occurring?

var allUsers = await client.Users.ListUsers().ToArrayAsync();


var allUsers = await client.Users.ListUsers(limit: 5).ToArrayAsync();

I am guessing it took about 30 minutes.
I know a few of our okta administrators got warming emails saying we were hit 60% of our limit.

What I want to do is show an initial list of Users. And then let the user do filtering or searches.

How would you suggest I get the initial list of users. Sort of like the way the Users | People page works.

Any suggestions?