Auth0 Home Blog Docs

Getting rid of "identifier expected" error in VSCode for rules

rules

#1

Auth0’s official documentation for rules recommends defining them in the following way:

function (user, context, callback) {
  context.idToken["http://mynamespace/hello"] = "world";
  console.log('===> set "hello" for ' + user.name);
  callback(null, user, context);
}

This anonymous function pattern shows up as an identifier expected. I could turn off the JS error checking, but I would love to leave it on to have VSCode check for any other possible errors.

Is there some other way to specify the function as a named function which would get rid of this error?