Skip to content

Helper for Auth0 API allowing to query unlimited amount of users

Notifications You must be signed in to change notification settings

kjarmicki/auth0-get-all-users

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Helper for Auth0 API allowing to query unlimited amount of users

Resources

Stars

Watchers

Forks

Packages

No packages published