Here’s the use case, which I’m sure many people have faced:
- Have bunch of users in Discourse
- Have an external system (service provider, Drupal) which uses API create Discourse users and manage group memberships
- Drupal has partially overlapping set of users. ie. Users with same email address exist in Discourse and Drupal, but aren’t linked
- Drupal uses API to sync users, groups, and memeberships because users might never use SSO to access Discourse, instead relying on emails
- Discourse sometimes rejects the API call to create a Discourse user, because a Discourse user already exists with same email
- Discourse links existing Discourse user to the Drupal user, via email
- Query discourse
/admin/users/list/all.json?email=$emailAPI endpoint to fetch any users with matching email address
- If the matching user exists
- Connect the existing users (Drupal side)
- Create a new discourse user
- Does this seem like a reasonable solution, or is there a better way to do it?
- Is the API query formed correctly?