Node-auth0 users.get() always returning all users

  • SDK: node-auth0
  • Version: 2.14.0
  • Platform: Local env is Node 11.5.

Building some CLI stuff with oclif.io, typescript, node-auth0:

There are three users and 6 clients in my test tenant. The following call to users.get() always returns all three users, whether I provide an actual user_id, a fake user_id, or no user_id:

auth0.users.get({ user_id: USER_ID }, function (err: any, user: any) {
  if (err) {
    // do a thing
  }
  console.log(user);
});

My equivalent call to clients.get() works as expected, only returning data for the specified client_id:

auth0.clients.get({ client_id: CLIENT_ID }, function (err: any, client: any) {
  if (err) {
    // do a thing
  }
  console.log(client);
});

The full code is here.

Kind of an inconsistency between the two, but users.get takes an id option for specifying the user ID that you are after:

auth0.users.get({ id: USER_ID }, function (err: any, user: any) {
  if (err) {
    // do a thing
  }
  console.log(user);
});

Code here:

1 Like

Is either of users.get or getUser (and other similar duplicated methods) preferred?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.