# Resetting or Destroying Single Sign On Records

**URL:** https://meta.discourse.org/t/resetting-or-destroying-single-sign-on-records/62619
**Category:** SSO
**Created:** [12 mei 2017 om 23:47 UTC](https://meta.discourse.org/t/resetting-or-destroying-single-sign-on-records/62619 "2017-05-12T23:47:14Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![qco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/qco/32/87160_2.png) [@qco](https://meta.discourse.org/u/qco)
#### Post date: [12 mei 2017 om 23:47 UTC](https://meta.discourse.org/t/resetting-or-destroying-single-sign-on-records/62619/1 "2017-05-12T23:47:14Z")

</div>

We have recently transitioned our main website from an old Django backed website to a new WordPress based website. We have migrated users, and are trying to switch the SSO provider from our old platform to our new one. Is there a fast/easy way to delete old single sign on records so that the new WordPress platform can re-sync users with their existing Discourse accounts?

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [13 mei 2017 om 09:20 UTC](https://meta.discourse.org/t/resetting-or-destroying-single-sign-on-records/62619/2 "2017-05-13T09:20:32Z")

</div>

There is a method called `SingleSignOnRecord.destroy_all`. I’m pretty sure that running it inside a rails console (`/var/discourse/launcher enter app`, `rails c`) will either do what you want… or hose your site.

If you’re adventurous, take a backup and try it, or wait for someone with more knowledge of this system to answer 😉

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [13 mei 2017 om 19:21 UTC](https://meta.discourse.org/t/resetting-or-destroying-single-sign-on-records/62619/3 "2017-05-13T19:21:46Z")

</div>

For reference, this topic relates to this [WP Discourse](https://github.com/discourse/wp-discourse) GitHub issue: [https://github.com/discourse/wp-discourse/issues/279](https://github.com/discourse/wp-discourse/issues/279).

I’ve tried out @fefrei’s approach in my development environment (with 10 users) and it worked there without any problems.

---

<div class="post-metadata">

### Author: ![qco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/qco/32/87160_2.png) [@qco](https://meta.discourse.org/u/qco)
#### Post date: [13 mei 2017 om 19:35 UTC](https://meta.discourse.org/t/resetting-or-destroying-single-sign-on-records/62619/4 "2017-05-13T19:35:07Z")

</div>

Thanks @fefrei and @simon – I can verify that it did work, and did not hose the site at all.

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [13 mei 2017 om 19:46 UTC](https://meta.discourse.org/t/resetting-or-destroying-single-sign-on-records/62619/5 "2017-05-13T19:46:42Z")

</div>

> [@qco](#):
>
> and did not hose the site at all

This sounds fishy – “It did not completely hose the site even a little bit!” 😆

Thanks for reporting back! 🙂

---

<div class="post-metadata">

### Author: ![eoin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eoin/32/123786_2.png) [@eoin](https://meta.discourse.org/u/eoin)
#### Post date: [20 november 2018 om 06:46 UTC](https://meta.discourse.org/t/resetting-or-destroying-single-sign-on-records/62619/6 "2018-11-20T06:46:42Z")

</div>

I’d like to understand _why_ deleting all SSO records would work.

Is it that doing so forces accounts to be matched again on **email address** , thus matching people again with their rightful Discourse accounts from the new SSO providor?

(In my context, the current SSO providor is a custom PHP app, and we’re migrating our entire membership platform to run on Wordpress.)

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [20 november 2018 om 06:50 UTC](https://meta.discourse.org/t/resetting-or-destroying-single-sign-on-records/62619/7 "2018-11-20T06:50:42Z")

</div>

Correct. In the absence of an SSO record matching the external ID, Discourse matches by email and creates a new SSO record 🙂

(If there is no matching account by mail, too, a new account and SSO record is created.)
