How to assign "admin" role, when new user signs up?

Hi @chetanbc,

Thanks for reaching out to the Auth0 Community!

I recommend using the Management API’s Assign roles to a user endpoint inside an Auth0 Pre-registration Action script to assign your users to the “admin” role.

Here is a sample:

exports.onExecutePostUserRegistration = async (event, api) => {

  const ManagementClient = require('auth0').ManagementClient;

  const management = new ManagementClient({
      domain: event.secrets.domain,
      clientId: event.secrets.clientId,
      clientSecret: event.secrets.clientSecret,
  });

  const params =  { id : event.user.user_id};
  const data = { "roles" : ["ROLE_ID"]};

  try {
    const res = await management.assignRolestoUser(params, data)
  } catch (e) {
    console.log(e)
    // Handle error
  } 
};

I recommend checking out our How can I use the Management API in Actions? FAQ for more instructions.

Please let me know if there is anything else I can do to help.

Thanks,
Rueben