# Eliminate accounts without main user account

**URL:** https://meta.discourse.org/t/eliminate-accounts-without-main-user-account/127826
**Category:** SSO
**Created:** [September 6, 2019, 5:44pm UTC](https://meta.discourse.org/t/eliminate-accounts-without-main-user-account/127826 "2019-09-06T17:44:33Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Kat\_F](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kat_f/32/161990_2.png) [@Kat\_F](https://meta.discourse.org/u/Kat_F)
#### Post date: [September 6, 2019, 5:44pm UTC](https://meta.discourse.org/t/eliminate-accounts-without-main-user-account/127826/1 "2019-09-06T17:44:33Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [September 6, 2019, 6:00pm UTC](https://meta.discourse.org/t/eliminate-accounts-without-main-user-account/127826/2 "2019-09-06T18:00:23Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Kat\_F](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kat_f/32/161990_2.png) [@Kat\_F](https://meta.discourse.org/u/Kat_F)
#### Post date: [September 6, 2019, 6:02pm UTC](https://meta.discourse.org/t/eliminate-accounts-without-main-user-account/127826/3 "2019-09-06T18:02:47Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [April 5, 2023, 12:22pm UTC](https://meta.discourse.org/t/eliminate-accounts-without-main-user-account/127826/4 "2023-04-05T12:22:33Z")

</div>



---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [April 5, 2023, 12:38pm UTC](https://meta.discourse.org/t/eliminate-accounts-without-main-user-account/127826/5 "2023-04-05T12:38:33Z")

</div>


