Node-auth0 ManagementClient vs UsersManager et al

I started working on a new general purpose Management API command line interface, using oclif and node-auth0 because, what else is there to do over the holiday season?! I haven’t pushed it to NPM or posted it in Show Your Auth0 yet because the code is a mess. I mean, I assume it’s a mess since I have almost no idea what I’m doing. I am completely new to node / typescript / javascript.

In general, is it recommended to call the methods of the ManagementClient object, such as getUser, vs. the methods of other objects like UsersManager and its users.get? ManagementClient methods seem to be wrappers around those other objects/methods.

Also, which node-auth0 method is used to query the user database? The only options seem to be ‘get a user by their user_id’, ‘get a user by their email address’, and ‘get all users’ (which must not even work for more than 1,000 users?) Maybe I’ve been staring at this too long but I can’t seem to find the appropriate method.

getAll makes a request to the /api/v2/users endpoint for which you can specify a search parameter. See Auth0 Management API v2 for an explanation of parameter, but a sample request would look like this:

managementClient.getUsers( {
  search_engine:'v3',
  q: 'name:john*'
}, callback);

Take a look at User Search Query Syntax for more details on the query search syntax.

As for using managementClient.getUsers or managementClient.users.getAll, it seems that the readme.md documentation favors the first approach (although I’m not speaking for the SDK team).

Thanks @nicolas_sabena. The node-auth0 docs only mentions setting per_page and page, but I know the API well enough that I should have just tried it anyway.

If I get a chance, I’ll submit a PR to update the documentation.

1 Like