Home > Mobile >  custom claim for multi sub users at once using cloud function?
custom claim for multi sub users at once using cloud function?

Time:05-12

What is the best way to update the custom claim of multiple sub users at once using a cloud function ? I mean is would a forEach on an array of lets say a list of users emails (strings) do this job ?

const list = ['[email protected]','[email protected]','[email protected]']


list.forEach((el)=>
getAuth()
  .getUserByEmail(el)
  .then((user) => {
      return getAuth().setCustomUserClaims(user.uid, {
        premium : true,
      });
  })
  .catch((error) => {
    console.log(error);
  });
  
  )

CodePudding user response:

There is no API to updated multiple users at the same time. You have to process them each individually.

  • Related