Auth0's users API v3 has a limitation of 1000 users per query (source). This module allows you to get all the users and manage them in your program.
First, you need to install it with npm i auth0-get-all-users
. Then:
const {ManagementClient} = require('auth0');
const getAllUsers = require('auth0-get-all-users');
const auth0 = new ManagementClient({
// initialize management client with your credentials
});
const allUsers = await getAllUsers(auth0).asArray(/* export job options, manager options */);
asArray
takes two parameters, both are optional.
First one contains options that are the same as user export job options.
Second one specifies export job manager behavior, specifically:
{
checkInterval: number, // time in ms, specifies how often should we check in Auth0 if export job is completed, default is 1000
checkRetries: number // maximum amount of retries the aforementioned check is performed, default is 30
}
Basically it creates user export job, downloads the results, uzips them, parses them as JSON and returns them to you.