Currently I am using facbook as my provider to log in to firebase.
The uid I get from that I save.
Next I make a call to the Facebook Graph api to retrieve a list of friends who use the current app.
I also get an id with this call but they do not match with the uid I get at login.
I would need a way to map my firebase users logged in with facebook to the friend list I get from the graph api.
I feel like I'm missing something obvious but I can't seem to find it.
Related
Goal
My goal is for a user to share something he created on my site to Facebook, and for me to display all comments on my own page using the Facebook comments plugin.
So my ideal flow would be:
User creates content with example id vjrjf834fdkfj, and shares using public URL http://example.com/vjrjf834fdkfj/.
User shares this URL on Facebook via my Facebook app ID. The post ID is 1234567.
I get this post ID. (This is what I need help with)
I store this in my database.
Whenever a visitor visit the page http://example.com/vjrjf834fdkfj/ I look up in the database what the post ID is (1234567 in this example), and call the Facebook comments plugin using this post ID.
What I tried
Attempt #1
First failed attempt: read the post_id field of the FB.ui callback but this response is typically empty because Facebook says that:
Only available if the user is logged into your app using Facebook and
has granted publish_actions. If present, this is the ID of the
published Open Graph story.
My user is not always logged into my app via Facebook, because he can also create a normal account.
Attempt #2
So my next attempt was to get a list of all posts of this app by calling the Graph API. I have a "basic" app with the "Website" platform set to my website URL (www.example.com). Given this list I might filter this on the relevant URL and voila, get the post ID for the right URL.
I can create an access token and call https://graph.facebook.com/v2.8/{app-id}/objects?access_token={token}, but this gives an error The parameter type is required. And when I try to get a list of object types by calling the /object_types endpoint, I get an empty list.
Attempt #3
I also played a bit with creating a Page Tab but the documentation makes no sense to me as to how that would apply to my case. I ended up with two extra pages, all empty, and not what I want. However, I could live with an extra page on my Facebook page showing a list of all posts that have been shared (so these posts would appear here and on my user's timeline).
Questions
So:
Why is this object_types list empty? I expect that something like "post" would show up here, allowing me to get a list of all posts associated with this app ID.
If this is not possible, how can I still achieve my end goal?
Thanks.
I would like to retrieve a Facebook user's id given their username.
Example: Given helloworld return 100003263065603.
I understand that the Graph API does not allow this anymore, but several sites, such as lookup-id and findmyfbid are able to do this.
I am guessing they are doing some sort of scraping? If so, how would I implement this in Node.js
Those sites most likely scrape the profile page, which is not allowed. Don´t do that, should not need to anyway. Just let the user authorize your App and you will get his (App Scoped) ID. There´s no serious application for using the username or his global ID anymore.
is there an easy way to get all Facebook friends that like a specific Facebook page?
I know that there is this site here
https://www.facebook.com/browse/friended_fans_of/?page_id=245323855526590
Where you can type in the page_id and get all friends that like this. But is this also possible with the Graph API? Or would I need to go every friend of a user, using the correct permission and THEN check if the user likes a specific page? I couldn't find an API Endpoint in the API Reference of Facebook
I facing a problem when trying to get Facebook friends list.
When user login Parse restore on the user AuthData a wrong (temporary) Facebook id, and than when I'm trying to pull the friends list I can't get it since the Facebook id is not the "real" Facebook id.
I'm getting all right permissions from Facebook at login time and can login my app.
Any suggestions?
You are most likely getting an App Scoped ID, see App-scoped User IDs changelog: https://developers.facebook.com/docs/apps/changelog
It is not a temporary one, it will stay the same for every User in one App. It is just not the "real" one.
If you don´t get the friends (with /me/friends, i guess), it´s probably because you only get the friends who also use your App. This is also explained in the changelog:
App Friends: The /me/friends endpoint no longer includes the full list of a person's friends. Instead, it now returns the list of that
person's friends who are also using your app.
Is there any way I can get a Facebook user's unlikes?
I can get a users likes by using /{user}/likes.
But is there any way I can see what likes the user has removed from that list? Or is there any other way to track 'unlikes'?
There's no API call you can make that will give you a list of what a user previously liked, but now does not.