Auth0 Home Blog Docs

Is it possible to use Object.defineProperty in Auth0 Rules?



I’m trying to create the following rule on Auth0:

function (user, context, callback) {
  // TODO: implement your rule
  var app = 'myAppName';
  var obj = {};
  Object.defineProperty(obj, app, { roles: 'admin, customer'});
  user.obj = obj;
  callback(null, user, context);

When I try the rule the user.obj property is equals {}

  "obj": {},
  "user_id": "auth0|0123456789",

Is there anything that I’m missing here?