Eliminate accounts without main user account

AI-generated summary

Kat_F asks if there’s a way to automatically close or detect Discourse forum accounts when their corresponding main site accounts are deleted or suspended, especially since the forum uses SSO to auto-create accounts. Falco suggests that the main site can use the /u/by-external/{external_id}.json endpoint to find the associated forum user and then programmatically close or suspend that account via API. Kat_F acknowledges the technical solution and plans to relay it to their developer. The core issue is maintaining sync between main and forum accounts without manual intervention.

I’m sorry if this has been covered somewhere, I’m not really even sure what keywords are usable for this issue.

To explain, our Discourse forum is adjunct to another site. Any user on that site can go to the forum links and automatically have an account created with the same username and avatar as is on the main site.

The problem we have is, that if a user closes their main account, or has it closed for bad behavior, the forum account will remain open unless we close / delete / suspend it manually.

Is there any way that we can reverse search accounts to see if they have a main connected to them? Alternatively, is there a way to make a forum account auto-close when the main no longer exists?

Thanks (in advance) for any help and again I’m sorry if this was already covered and I missed it.
Kat

I assume that you are using SSO between the sites.

So when closing an account in the main site it can query the forum using a GET to /u/by-external/{external_id}.json to retrieve the forum account, and then use the user_id in the response to issue an subsequent request closing the forum account.

I honestly don’t know how it was done, I’m just a forum admin, but thank you - I will pass this information on to the fellow who does that kind of thing.