How can i get all of my users who authenticate

hello,
i creates authentication using moralis and i want to get all of my authenticated users with api in js how can i do that ???

hello, you can do that only in a cloud function or in backend, because current user authenticated in front end can not read data about the other users

for example you could try a cloud function that starts like this

Moralis.Cloud.define("getAllUsers", async (request) => {
  const query = new Moralis.Query("User");
  const queryResults = await query.find({useMasterKey: true})
  const results = [];

  for (let i = 0; i < queryResults.length; ++i) {
    results.push({
1 Like

thanks but your code was not complit but i undrestand TY!

and can you give me link of docs for command like this ??

this is the documentation for v1
https://v1docs.moralis.io/moralis-dapp/cloud-code

it is the same as for parse server, as cloud code comes from parse server and a moralis server is using parse server