-
Notifications
You must be signed in to change notification settings - Fork 154
Open
Description
When trying to list all application users using Pagination (while resp.has_next()
), the query param limit
does not work. Okta will just ends up fetching all the application users.
Without pagination, the query param limit
works.
However, when using with pagination (which is required to fetch a number of users > default page size: 50), the limit
becomes the batch size of users to fetch in each page.
Code
I added a custom break to stop the client when the number of users fetched > limit
.
async def list_okta_app_users(okta_conf: dict, filter: str = "", limit: int = 0) -> list[AppUser]:
app_users: list[AppUser] = []
q_params: dict = {}
if filter:
q_params["filter"] = filter
if limit:
q_params["limit"] = limit
# Query Okta for application users
async with OktaClient(user_config=okta_conf) as client:
users, resp, err = await client.list_application_users(okta_conf['clientId'], q_params)
while resp.has_next():
app_users.extend(users)
users, err = await resp.next()
if err:
print(err)
break
# Custom break
if len (app_users) > q_params["limit"]:
print(f"Okta Client fetched more users than specified query params limit: {q_params['limit']}")
break
return app_users
Screenshot

Expectation
The query param limit
is specified, when resp.has_next()
should return False to stop fetching more users.
Okta version
Latest: v2.9.8
Metadata
Metadata
Assignees
Labels
No labels