Fetch list of users with auth0js

I am using auth0js in my app.

Now I need to fetch all users in order to show managers which of the users listed in the users table in the app have an account.

I have searched the docs (Auth0.js v9 Reference) and found nothing :frowning: .

Does that mean that I have to now user the API (Auth0 Management API v2) directly, even though I have created a const auth0Manage = new auth0.Management instance in auth0js?

Can I at least use auth0Manage.baseOptions.token or do I have to fetch a different one?

@alex.barbalex,

You are not going to be able to (or want to) give your client side app the ability to get all users from the management api. You will want to do this in your backend. Take a look at this FAQ for some more info about why: How do I use the Management API in my single page application?

You can also get all users without a number limit using a long running export job, which will return a file in JSON or CSV format: Auth0 Management API v2

Alternatively, you can use the Import/Export extension: User Import / Export Extension.

Does this answer your question?

Thanks,
Dan

Obviously I need to get more security aware…

And I just realized I only have to save the ID passed with login to my users table to know who has an account.

Thanks a lot, @dan.woda

@alex.barbalex,

That is one reason to keep the conversation going here on the Community. I am happy to give my input and source information from the rest of the team.

Let me know if you have questions about anything else!

Best,
Dan

1 Like

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