# Accessing Facebook account specific details for Discourse user

**URL:** https://meta.discourse.org/t/accessing-facebook-account-specific-details-for-discourse-user/50074
**Category:** SSO
**Created:** [13 Setembro , 2016 10:29 UTC](https://meta.discourse.org/t/accessing-facebook-account-specific-details-for-discourse-user/50074 "2016-09-13T10:29:19Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![chitale\_prasad](https://avatars.discourse-cdn.com/v4/letter/c/a9a28c/32.png) [@chitale\_prasad](https://meta.discourse.org/u/chitale_prasad)
#### Post date: [13 Setembro , 2016 10:29 UTC](https://meta.discourse.org/t/accessing-facebook-account-specific-details-for-discourse-user/50074/1 "2016-09-13T10:29:19Z")

</div>

I have configured Facebook and Google for SSO. My users are able to login to discourse using her Facebook or Google account. I will now like to access Facebook/Google account details of the created discourse user such as Unique Id, name , email received from Facebook or Google.

I accessed user details using users/username.json. However I am not able to find anything in the JSON which is saying that the user was created from Google or Facebook and more details about the same.

---

<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: [13 Setembro , 2016 22:14 UTC](https://meta.discourse.org/t/accessing-facebook-account-specific-details-for-discourse-user/50074/2 "2016-09-13T22:14:50Z")

</div>

Any tips here @sam I know we do display the various login info on the user, showing which login methods are connected, so it is kinda available.

---

<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: [14 Setembro , 2016 07:56 UTC](https://meta.discourse.org/t/accessing-facebook-account-specific-details-for-discourse-user/50074/3 "2016-09-14T07:56:35Z")

</div>

There is no API really to expose the information and we only take a bare skeleton of the data.

For Facebook we have:

```plaintext
#<FacebookUserInfo:0x0055928a7a8678
  id: 2560,
  user_id: 1,
  facebook_user_id: 123,
  username: nil,
  first_name: nil,
  last_name: nil,
  email: "some@email.com",
  gender: nil,
  name: "Some Name",
  link: nil,
  created_at: Sun, 11 Sep 2016 16:08:46 UTC +00:00,
  updated_at: Sun, 11 Sep 2016 16:08:46 UTC +00:00>,

```

It appears that recently facebook have gotten even more strict and restricted data flow.

---

<div class="post-metadata">

### Author: ![chitale\_prasad](https://avatars.discourse-cdn.com/v4/letter/c/a9a28c/32.png) [@chitale\_prasad](https://meta.discourse.org/u/chitale_prasad)
#### Post date: [14 Setembro , 2016 09:56 UTC](https://meta.discourse.org/t/accessing-facebook-account-specific-details-for-discourse-user/50074/4 "2016-09-14T09:56:27Z")

</div>

Thanks sam

The facebook\_user\_id you had mentioned , is it stored in Discourse user  
profile somewhere? Can I access it using API?

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [24 Setembro , 2016 16:47 UTC](https://meta.discourse.org/t/accessing-facebook-account-specific-details-for-discourse-user/50074/5 "2016-09-24T16:47:07Z")

</div>

The facebook\_user\_id is an application-specific user ID, that is, it only means anything in combination with the API keys used. They’re not giving you a real user ID that you can give to any other application.

---

<div class="post-metadata">

### Author: ![chitale\_prasad](https://avatars.discourse-cdn.com/v4/letter/c/a9a28c/32.png) [@chitale\_prasad](https://meta.discourse.org/u/chitale_prasad)
#### Post date: [3 Outubro , 2016 05:45 UTC](https://meta.discourse.org/t/accessing-facebook-account-specific-details-for-discourse-user/50074/6 "2016-10-03T05:45:50Z")

</div>

Hi Kane,

May be I have referred wrong id. What I am looking for is a unique id Facebook gives after implementing Facbook Login.

1. Please visit  
[https://developers.facebook.com/docs/facebook-login/web](https://developers.facebook.com/docs/facebook-login/web)

2. pl go to section -\>1. Checking Login Status

3. Check the contents of response object {  
status: ‘connected’,  
authResponse: {  
accessToken: ‘…’,  
expiresIn:‘…’,  
signedRequest:‘…’,  
**userID:‘…’**  
}  
}  
I have highlighted UserID in above response. userID is the ID of the person using the app. I am interested in knowing this id returned by facebook to discourse.

Regards  
Prasad

---

<div class="post-metadata">

### Author: ![Shrike](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shrike/32/68103_2.png) [@Shrike](https://meta.discourse.org/u/Shrike)
#### Post date: [22 Fevereiro , 2017 18:56 UTC](https://meta.discourse.org/t/accessing-facebook-account-specific-details-for-discourse-user/50074/7 "2017-02-22T18:56:37Z")

</div>

I have similar concerns: I have a forum with Facebook only logins. But people can change their user names (first name/last name) and emails. In user profile I can see only “Connected acounts: Facebook()” - that’s all.

So I’d like to have any relation to original FB account from Discourse account. Is it possible?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [30 Novembro , 2018 11:34 UTC](https://meta.discourse.org/t/accessing-facebook-account-specific-details-for-discourse-user/50074/8 "2018-11-30T11:34:34Z")

</div>

Data can be accessed on the console using `UserAssociatedAccount.where(provider_name: "facebook").all`

We also now allow users to disconnect/reconnect accounts:

> [@Ability to connect with OAuth providers when user is registered?](https://meta.discourse.org/t/ability-to-connect-with-oauth-providers-when-user-is-registered/42457/12):
>
> Connecting and revoking social logins is now possible. Discussion about merging the authentication tables can continue here:
