I think we can pass the fields that we need when making the API call. So we can include “roles” and then it will return all members along with their roles.
Here is a sample code using auth0 sdk
const auth0 = new ManagementClient({
domain,
clientId,
clientSecret,
audience,
});
const response = await auth0.organizations.getMembers({
id: '<org_id>',
include_fields: true,
fields: 'roles,name',
include_totals: true,
});
console.log(response.data);