skip to Main Content

I’m trying to get the facebook friends of my new users (to recommend them friends). I did all the work: integrated facebook in the app, permission facebook etc.

Then I use this to get the users

curl -i -X GET 
 "https://graph.facebook.com/v4.0/ i put the user id here }?fields=id%2Cfriends&access_token= my acces token"

It works, but there’s a problem with the id’s:

If i use the facebook graph API: it says my ID is : 23337 … (only digits).

If i log in with facebook in the flutter app: my ID is: M670V … (digits + (capital) letters )

Only the id with only digits works for the curl.
How can I get the id with only digits from the flutter facebook sing in?

Thank you!

2

Answers


  1. Chosen as BEST ANSWER

    After a bit of research,

    The id with digits + letters is the firebase ID, it differs from the real facebook id.

    Thanks for the help!


  2. In login with facebook using firebase authentication, the uid is the firebase id so if you need facebook userId the call one api for get.

    var graphResponse = await http.get(
    'https://graph.facebook.com/v2.12/me? 
    fields=name,first_name,last_name,email&access_token=${facebookLoginResult
    .accessToken.token}');
    
    var profile = json.decode(graphResponse.body);
    print(profile.toString());
    //it return detail of facebook user
    

    https://developers.facebook.com/docs/graph-api/using-graph-api/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search