# Deleting a user does not destroy the single sign on record

**URL:** https://meta.discourse.org/t/deleting-a-user-does-not-destroy-the-single-sign-on-record/28774
**Category:** Bug
**Created:** [Mai 13, 2015, 4:59 UTC](https://meta.discourse.org/t/deleting-a-user-does-not-destroy-the-single-sign-on-record/28774 "2015-05-13T16:59:31Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![dansingerman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dansingerman/32/115687_2.png) [@dansingerman](https://meta.discourse.org/u/dansingerman)
#### Post date: [Mai 13, 2015, 4:59 UTC](https://meta.discourse.org/t/deleting-a-user-does-not-destroy-the-single-sign-on-record/28774/1 "2015-05-13T16:59:31Z")

</div>

We have the situation where we use single sign on, and a record got created with the wrong email address.

I believe if we delete the user and recreate them again (with the correct email address) via the API sync\_sso method the problem will resolve.

However this doesn’t work, the deleted user gets resurrected.

Eyeballing the code it doesn’t look like the UserDestroyer destroys any related SingleSignOnRecord instances, which I think explains this.

Should the UserDestroyer destroy SingleSignOnRecords? Is there a use case where we would not want this to happen?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [Mai 13, 2015, 10:21 UTC](https://meta.discourse.org/t/deleting-a-user-does-not-destroy-the-single-sign-on-record/28774/2 "2015-05-13T22:21:35Z")

</div>

Not sure, this is a question for @sam I think.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [Juin 1, 2015, 5:46 UTC](https://meta.discourse.org/t/deleting-a-user-does-not-destroy-the-single-sign-on-record/28774/3 "2015-06-01T05:46:28Z")

</div>

Its actually destroying, do you have a repro test case:

> <https://github.com/discourse/discourse/blob/main/app/models/user.rb#L47>

---

<div class="post-metadata">

### Author: ![dansingerman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dansingerman/32/115687_2.png) [@dansingerman](https://meta.discourse.org/u/dansingerman)
#### Post date: [Juin 2, 2015, 9:35 UTC](https://meta.discourse.org/t/deleting-a-user-does-not-destroy-the-single-sign-on-record/28774/4 "2015-06-02T09:35:12Z")

</div>

No, this is my mistake, you are right that it deletes the SSO record. I had a slightly different issue, but don’t thinks it’s a bug.

Thanks for looking 😄

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [Juin 2, 2015, 9:46 UTC](https://meta.discourse.org/t/deleting-a-user-does-not-destroy-the-single-sign-on-record/28774/5 "2015-06-02T09:46:12Z")

</div>


