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

Limiting the amount of users returned ListApplicationUsers #596

Closed M21x closed 2 years ago

M21x commented 2 years ago

Describe the bug?

Ran to an issue where setting the limit in the ListApplicationUsers() did not do anything.

var user = await oktaClient.Applications.ListApplicationUsers(appId, limit: 1).ToArrayAsync();

When calling this method the limit is ignored and returns all users assigned to the appId.

What is expected to happen?

Limit the user to the value that was set.

What is the actual behavior?

Returning all users instead of the set value.

Reproduction Steps?

Create an OktaClient give the required information for OktaClientConfiguration

Call the ListApplicationUsers() and set the limit.

var user = await oktaClient.Applications.ListApplicationUsers(appId, limit: 1).ToArrayAsync();

Additional Information?

No response

.NET Version

5.0.102

SDK Version

5.6.2

OS version

No response

laura-rodriguez commented 2 years ago

Hi @manny21x,

Thanks for reporting this issue.

Can you please confirm if this is an SDK or API issue? For example, if you make the same request via Postman, do you face the same issue?

M21x commented 2 years ago

Seems like this is an SDK issue. I tried it through postman and it works.

laura-rodriguez commented 2 years ago

Thanks for your reply, @manny21x. Would you mind sharing the request the SDK ends up doing? A Fiddler log/HAR file would be really helpful for us to understand what's going on. Thank you!

M21x commented 2 years ago

Hi, I read the documentation again, it seems like I needed to do manual pagination

https://github.com/okta/okta-sdk-dotnet#manual-pagination

This fixed the issue and the limit parameter works now.

laura-rodriguez commented 2 years ago

Awesome! Closing this issue since you found a fix. Thank you!