Adding role to user from hook

After further digging, I determined that hooks are a newer mechanism to do this kind of stuff, and would likely be more reliable.

No, that’s not correct (about reliability). Both Rule and Hooks are reliable in the same way. Hooks and Rules have different extension points (Rules trigger upon a successful authentication, Hooks trigger at user registration (only for database connections)).

Rules can be used for your use case, and the benefit is that you have the auth0 helper object at hand.

Regarding this question:

That auth0 object that your rule runner makes available to the rule doesn’t seem to be available in the hook. Is there something else I should use?

There is no other way (no helper object) in Hooks than making raw Node.js requests.

I got the Slack piece moved easily enough, but I’m stuck on the role piece.

In case you want to continue with Hooks: what in your code sample doesn’t work, where/how does it fail?

1 Like