Auth0 Home Blog Docs

Have multiple methods in a rule

Hey community,

With time my auth0 rule has expanded in size. In order to make it readable and maintainable, I decided to divide it into separate methods. I thought it would be as easy as it is to do in Javascript. But it doesn’t seem to.

It keeps giving me compilation errors for unexpected tokens. I also tried using the global object as specified here.

I may be missing something too small. Any help would be appreciated.
Thank you!

I believe the expectation for rules is that each contains a single function at the top-level which meets the contract in terms of parameters. However, inside that top-level function you can indeed define as many other functions as you require. Can you confirm that you’re defining the additional functions inside the top-level rule function?

1 Like

Okay… No I wasn’t defining them inside the top-level function. But it worked when I did so. Thanks a lot!!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.