Accessing Facebook account specific details for Discourse user

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.

1 Like

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

For Facebook we have:

  id: 2560,
  user_id: 1,
  facebook_user_id: 123,
  username: nil,
  first_name: nil,
  last_name: nil,
  email: "",
  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
    Web - Facebook Login - Documentation - Facebook for Developers

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

  3. Check the contents of response object {
    status: ‘connected’,
    authResponse: {
    accessToken: ‘…’,
    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.


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?

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

We also now allow users to disconnect/reconnect accounts: