FirebaseAuth android get Facebook friends list - android

I use facebook login in my app. Once the users are logged-in I can get their basic facebook info such as display name, email, and phot url.
I'd like to get their facebook friends list. I think I can get it "directly" with firebase but I don't remember how and I cannot find any info about it. I think I first have to tell Firebase to get friends list when people login with facebook, then I sould be able to get it with a method such as firebaseAuth.getCurrentUser().getFriendList().
Do you know how to get facebook friends list with firebaseAuth ?
Thank you,
Alex

It is feasible, but only the friends that also use your app. The trick is to add a scope to your login method. In Angular it looks like this
this.afAuth.auth.signInWithPopup(new firebase.auth.FacebookAuthProvider().addScope('user_friends'))
That scope at the end is the trick. Then, you need at least two users that are friends on facebook to login. You will note the popup is different as it now asks permission for the user's friends.
The response will include an access token. Then you can use that token to request the user's friends that are also using the app with a GET request like this
https://graph.facebook.com/v2.11/{facebook_uid}/?fields=friends{name,id}&access_token={access_token}
Note I'm using a particular version, but you should change that to whatever you need.

generally obtaining user's all friends list from Facebook is not possible, they removed this option years ago, with API v2.0 introduction... more info about and useful suggestions HERE
there is an official FB API called Graph API and HERE you have some doc about friend lists
and the Firebase... well, this is Google's product and it have nothing to do with Facebook... You are probably using FB mail address for creating an account in Firebase service/database, but it is keeping only this data plus some additional attributes if set (like photo or visible name).
firebaseAuth.getCurrentUser() returns FirebaseUser object, which have THESE methods - like you see: logpass, name, photo url and only few more methods. no option for getting friends list, because there is no method to set them, and no possibility to get this list from FB lib/API

Related

Unable to get a link to app user's Facebook Home page [duplicate]

I have facebook user ID's
using this id's am accessing profile page of that particular user id.
link will be look like https://www.facebook.com/100001533612613
this link not working now.
https://facebook.com/zuck
https://www.facebook.com/100001533612613 (**not working**)
https://www.facebook.com/profile.php?id=100001533612613 (**not working**)
https://m.facebook.com/ChrisHughes
how can i see profile using UserId
how can i access profile using UserId
You can’t, because you are not supposed to any more …
You will now need to ask for the user_link permission first, and then you can request a (temporary) link to their profile via the link field.
https://developers.facebook.com/docs/graph-api/changelog/version3.0#login

How do I open facebook url with app assuming that I can't get global userId via graph api

I am trying to get permission to access user's public profile so I can provide a link to this person's profile to other people using an app.
within the api response, we have a "link", but it is a https://facebook.com/... link, and not some intent link like fb://profile/<id>
So how can I create this link without global user id and username?
I also tried to use fb://facewebmodal/f?href=<link> but it redirects me to my own facebook home page (feed)
Thank you!
Dhiogo's anwser is not working anymore. Facebook's API retrieves an user_id when the user authenticates within your application. So all you have to do is use this user_id like this:
fb://facewebmodal/f?href=https://www.facebook.com/profile.php&user_id=[user_id]
This is a closed bug that Facebook didn't fixed: https://developers.facebook.com/bugs/332195860270199
But I could find a solution!!! All you have to do is to get the scoped link that facebook graph api generates (link permission) and replace the https://facebook.com/app_scoped_user_id/ with fb://profile/?app_scoped_user_id/ leaving the rest of the link as it is.
I hope this can help you.

How to get facebook friends phone,email,address and others friends detail information?

How to get Facebook friends's phone, email, address and others friends detail information use Facebook Android SDK 4.4 .
Now I can only get firends id and profile picture by use https://graph.facebook.com/me/taggable_friends? access_token
Sorry dude you cant!
Facebook's new API dosent allow you to take any information such as email,phone number etc
The only chances are
1. me/taggable_friends - Where you can get an Id for tagging your friends and profile picture ( your friends must also use the same app I think)
2. me/invitable friends - This one is for games only to invite people into
your game
I am unable to find the exact link for you but I've read it in developers.facebook itself.
Here is the changelog

Android: How to get facebook user image using access_token

I am working on an application that need to login with facebook. This is the first time when i am integrating Fb API in my application. I have start from Getting Started with the Facebook SDK for Android & successfully get fb access_token. There are three Activitie in my application & what i need to manage is to have logged in user's Profile Image & name on all these Activities when user successfully get login using facebook.I know, i can query fb GraphAPI & get complete profile data of current logged-in user using access_token. I succeed to get profile data of user by using valid access_token using_https://graph.facebook.com/me?<access_token>&format=json I need the profile image of login user as well(which need user's fb_id)http://graph.facebook.com/<fb_id>/picture?type=largeIs it possible to get user's profile image using access_token?
Finally, after a long search, i got the way to access login user's image by using only access_token
https://graph.facebook.com/me/picture?access_token=<your_access_token_here> thanks to #Jess for your valuable answer!
You don't need an access token to retrieve a user's profile image. Just issue a http GET request on http://graph.facebook.com/YOUR_ID_HERE/picture, so for example:
http://graph.facebook.com/4/picture gets you user id 4's picture, no access token needed.
EDIT:
To fetch the picture without knowing their fb id but with their access token, just execute a GET request on /me?fields=name,picture and you will receive a response with the URL to their profile picture.
See Graph API Tool example:
https://developers.facebook.com/tools/explorer/?method=GET&path=me%3Ffields%3Dname%2Cpicture
So after messing around with the facebook graph apis for a bit, I have found that you can get the profile pic in two ways:
Use this as the profile pic url by substituting the user id:
https://graph.facebook.com/USER_ID/picture?return_ssl_resources=1
Using the access token:
https://graph.facebook.com/me/picture?access_token=ACCESS_TOKEN
Hope this is helpful.

How to get a friends user wall from facebook?

I want to read my friends posts (feeds?, all posts but for a specific user only) from his user wall.
I need all (posts, feeds, statuses) that i see when i look at his page directly from the website.
I use the android sdk and i tried the graph api and rest method.
My app is registered and i have logged in facebook to get the access token (permission: read_stream)
but i dont get that infos that want to.
Please help.
Thx.
How about testing your Graph API call in the Graph API Explorer?
https://developers.facebook.com/tools/explorer/
In my case, I could get my first 10 friends' feed (wall) with the url https://graph.facebook.com/me?fields=friends.limit(10).fields(feed)
Note that I used field expansion of the Graph API.
http://developers.facebook.com/docs/reference/api/field_expansion/
You need them to actually use your app and grant full permissions via the graph API.
You cannot simply 'grab a friends wall'. You must do that via your app and it needs the permissions to do so from the user in question.

Categories

Resources