Domain rule for organizations feature

I was planning to add a rule and replace their pipeline entirely (enable auto membership ), haven’t tested it yet end to end. theres a chance that this approach doesn’t work

var ManagementClient = require('auth0@2.37.0').ManagementClient;

  var management = new ManagementClient({
    token: configuration.members_access_token,
    domain: auth0.domain
  });

  management.organizations.getMembers({id: context.organization.id}, function (err, members) {
        console.log(err);
    console.log(members);
    callback(null, user, context);
  });