I may well add that later, but for a number of reasons, including:
- group membership is volatile (e.g. existing customer purchases a new training programme that has an associated group/category)
- how our different systems are (or are not) coupled
- subtle differences in our SSO registration / authentication flow depending on whether user is creating an SSO account with username/password or authenticating to our SSO using a federated identity like Google
the safest and simplest thing to do is to check on login each time.
However because the email field IS populated in the user_login webhook I won’t need to query the Discourse user for email (that was a bit of a side track). I’m still going to have to query the user to add them to a group because that endpoint needs usernames not ids, and for a whole set of reasons I won’t bore you with we aren’t tracking the Discourse username externally