Build an Admin Dashboard with Express and Vue: Adding User Authorization

Learn how to use the Auth0 Management API with Vue and Express to build an admin dashboard that gets user information and delete users.
Read more…: Available today!

Brought for you by @holly

Let us know your thoughts about the article!

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

Hi,
I have followed the article carefully and made the changes in my app/dashboard.
After making the changes I’m still not able see the users list in the dashboard.

And I’m getting below error in the server application when I access the url directly. This may be correct.

Overall I’m not able to see the list of users.
Anyone else also experience similer issue.?

I followed the guide but keep getting the error management.getUsers is not a function

Tried other functions in ManagementClient - Documentation but it also doesn’t work.

Is there something wrong with the node-auth0 package?

Hi @davidplane, sorry to hear you are having issues with the node-auth0 package.

In order to list the users in your Auth0 tenant, you need to access the user object as follows:

import { ManagementClient } from 'auth0';

const management = new ManagementClient({
  domain: '{YOUR_TENANT_DOMAIN}',
  clientId: '{YOUR_CLIENT_ID}',
  clientSecret: '{YOUR_CLIENT_SECRET}',
});

const allUsers = [];
const users = await management.users.getAll({
  include_totals: true,
  page: 0,
});

For documentation related to the SDK, please refer to the official SDK docs here: auth0

I’ll also take a look into this tutorial as it has been published a few years back, and it is perhaps not displaying accurate information.

Hope this helps!
Thanks

1 Like

ah i guess i was looking at old documentation. I have checked that the api has the required permissions but I’m currently getting empty response for retrieving all users. The machine to machine application was also authorized.

Do you know what could be the issue?

Update: I’ve tried with the auth0-python package and everything works fine. Using the same client id and secret also

Hi @davidplane, both libraries should work in the same way with the same parameters, after all, both libraries are a wrapper to the Auth0 Management API. With that said, is it possible that you have more than one database connection in the Auth0 Dashboard? If that’s the case, try adding the parameter connection to the getAll function, and send in the right connection name. For example:

const users = await management.users.getAll({
  include_totals: true,
  page: 0,
  connection: "Username-Password-Authentication",
});

Please let me know if that works for you.

1 Like

ah that seems to be it! Thank you!

1 Like