Accessing Facebook account specific details for Discourse user

AI-generated summary

The discussion revolves around accessing Facebook account details, such as the unique user ID, for Discourse users who log in via Facebook or Google SSO. chitale_prasad wants to retrieve specific user data like the Facebook user ID returned during login, which is used to identify users in the Facebook ecosystem. sam explains that Discourse stores minimal Facebook user info, including a facebook_user_id, but clarifies that this is an application-specific ID, not a globally unique Facebook ID. riking adds that this ID is only meaningful within the context of the app’s API keys. chitale_prasad clarifies the desired ID is the userID from Facebook’s login response, which is not directly exposed via the Discourse API. Shrike raises a similar concern, noting that user profile data like names and emails can change, making it hard to link back to the original Facebook account. The core issue is the lack of a reliable, accessible way to link Discourse users to their original Facebook identities.

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.

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.

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

For Facebook we have:

#<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.

Thanks sam

The facebook_user_id you had mentioned , is it stored in Discourse user
profile somewhere? Can I access it using API?

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.

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

  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

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?