auth0-get-all-users
v1.1.0
Published
Helper for Auth0 API allowing to query unlimited amount of users
Downloads
88
Readme
Auth0 Get All Users
Purpose
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.
Usage
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
}
How does it work?
Basically it creates user export job, downloads the results, uzips them, parses them as JSON and returns them to you.