# How To Fix / Remove All Facebook Logins For Updated AppID

**URL:** https://meta.discourse.org/t/how-to-fix-remove-all-facebook-logins-for-updated-appid/87831
**Category:** Bug
**Created:** [5월 18, 2018, 1:46오후 UTC](https://meta.discourse.org/t/how-to-fix-remove-all-facebook-logins-for-updated-appid/87831 "2018-05-18T13:46:54Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![yyhmsg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yyhmsg/32/115542_2.png) [@yyhmsg](https://meta.discourse.org/u/yyhmsg)
#### Post date: [5월 18, 2018, 1:46오후 UTC](https://meta.discourse.org/t/how-to-fix-remove-all-facebook-logins-for-updated-appid/87831/1 "2018-05-18T13:46:54Z")

</div>

Due to recent fb changes, I created a new app for my forum facebook login (one that didn’t include unnecessary permissions as I had setup before).

Upon adding this and trying to login I get:  
Oops  
The software powering this discussion forum encountered an unexpected problem. We apologize for the inconvenience.

Detailed information about the error was logged, and an automatic notification generated. We’ll take a look at it.

No further action is necessary. However, if the error condition persists, you can provide additional detail, including steps to reproduce the error, by posting a discussion topic in the site’s feedback category.

===  
Looking into the logs it seems it is trying to set a duplicate key for facebook login credentials.

ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR: duplicate key value violates unique constraint “index\_facebook\_user\_infos\_on\_user\_id” …

How can I clear all of those out and get going with the new app id?

And this is maybe? a bug? - shouldn’t it overwrite this by default - like if a user changed their facebook name - or is this just an app id issue?

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [5월 18, 2018, 5:49오후 UTC](https://meta.discourse.org/t/how-to-fix-remove-all-facebook-logins-for-updated-appid/87831/3 "2018-05-18T17:49:25Z")

</div>

I’m looking into this.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [5월 21, 2018, 6:38오후 UTC](https://meta.discourse.org/t/how-to-fix-remove-all-facebook-logins-for-updated-appid/87831/4 "2018-05-21T18:38:17Z")

</div>

I can reproduce this. I just created a new FB login app and connected it to [try.discourse.org](http://try.discourse.org). I can no longer log in with my FB account.

Relevant error in logs:

```plaintext
ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_facebook_user_infos_on_user_id"
DETAIL: Key (user_id)=(129) already exists.
: INSERT INTO "facebook_user_infos" ("user_id", "facebook_user_id", "first_name", "last_name", "email", "name", "created_at", "updated_at", "avatar_url") VALUES (129, 10215632354952089, 'Joshua', 'Rosenfeld', 'email_redacted', 'Joshua Rosenfeld', '2018-05-21 18:36:20.981945', '2018-05-21 18:36:20.981945', 'http://graph.facebook.com/v2.6/10215632354952089/picture') RETURNING "id")
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-mini-profiler-1.0.0/lib/patches/db/pg.rb:92:in `async_exec'

```

@sam, is this something you can fix?

---

<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: [5월 22, 2018, 1:53오전 UTC](https://meta.discourse.org/t/how-to-fix-remove-all-facebook-logins-for-updated-appid/87831/5 "2018-05-22T01:53:30Z")

</div>

Oh … we need to nuke all old facebook user infos when a new app is configured, I think the opening move here is just to write a howto on this, can you take that.

If you change facebook auth app

```plaintext
./launcher enter app
rails c
FacebookUserInfo.delete_all

```

---

<div class="post-metadata">

### Author: ![yyhmsg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yyhmsg/32/115542_2.png) [@yyhmsg](https://meta.discourse.org/u/yyhmsg)
#### Post date: [5월 22, 2018, 12:11오후 UTC](https://meta.discourse.org/t/how-to-fix-remove-all-facebook-logins-for-updated-appid/87831/6 "2018-05-22T12:11:04Z")

</div>

Awesome - works like a charm. Thanks for the quick help!

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [5월 22, 2018, 1:55오후 UTC](https://meta.discourse.org/t/how-to-fix-remove-all-facebook-logins-for-updated-appid/87831/7 "2018-05-22T13:55:55Z")

</div>

No problem. It sounds like you want a dedicated howto - any reason not to just append this to the existing howto on configuring FB login? Perhaps a “troubleshooting” section at the end?

---

<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: [5월 22, 2018, 9:37오후 UTC](https://meta.discourse.org/t/how-to-fix-remove-all-facebook-logins-for-updated-appid/87831/8 "2018-05-22T21:37:51Z")

</div>

I think appending this to the main howto is probably good enough for now

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [5월 23, 2018, 12:34오후 UTC](https://meta.discourse.org/t/how-to-fix-remove-all-facebook-logins-for-updated-appid/87831/10 "2018-05-23T12:34:23Z")

</div>

Added to [Configure Facebook login for Discourse](https://meta.discourse.org/t/configuring-facebook-login-for-discourse/13394).

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [5월 24, 2018, 10:00오후 UTC](https://meta.discourse.org/t/how-to-fix-remove-all-facebook-logins-for-updated-appid/87831/11 "2018-05-24T22:00:01Z")

</div>

This topic was automatically closed after 33 hours. New replies are no longer allowed.
