Authorization Extension - right way to auto-assign a role to a user upon signup *or* import

What is the best/most-proper way to auto-assign a role (an already defined role) to a new user either when they signup, or when they are imported upon first login?

  1. Custom rule? it seems cheesy to have a rule that only applies to a new user signup / import, because this rule will be executed every time the user authenticates or renews their access token → 1000’s of times for an ‘event’ that only occurs once. Also, within a rule, how do you know it’s the first time the user has authenticated unless you do something (again, cheesy) like make a flag property on the user’s profile.
  2. Web-hook instead of a rule? 2a-Web Hooks still say beta, should we use them in a production environment? 2b-Will the (web hook) pre-registration event occur for import as well as for a ‘true signup’? 2c-Can I know the client in a web hook? I see how to know what DB connection it is, but in this case, I only want to assign the (default) role to the new user if/when they are signing in or logging in for the first time via a specific client. IOW, I don’t want every user for a given connection to get the role.

Regarding 2c. the official documentation for web-hooks says: “For example, the client object comes with the following parameters: client name, client ID…”, but per the parameters detail documentation, only the connection & user data is available, not the client initiating the new user.

3 Likes