I am trying to get friends list from Facebook using Facebook C# SDK.
FacebookClient fb = new FacebookClient();
dynamic me = fb.Get("me");
But I am getting all other data from me except friends related(id,name..) data,
its always giving null value.
Does anyone know what is the Problem?
Yes, the "problem" is stated in the docs:
Friend list now only returns friends who also use your app: The list of friends returned via the /me/friends endpoint is now limited to the list of friends that have authorized your app.
See
https://developers.facebook.com/docs/apps/changelog#v2_0_login
FB has (somewhat) recently changed their API such that when you request the logged in user's friends, you only get those friends who are also using your FB application.
Unless you register your FB app as a game, you will not be able to see all of the logged in user's friends, only those who have also logged into your app, and have not disabled the option to show up in other people's friend lists.
Be aware that you can't simply lie that you are making a game, FB has to review your app before giving you persmissions to see the full friends list.
Related
I'm currently building a game with unity and Firebase, but instead of using Firebase authentication for Facebook, I did it on my own.
Now when the game starts, I wanna check if the user logged-in in the past(if he exists in the database), but I can't seem to figure it out. (Also, i'm using Push() to generate unique ids).
How do I get only the data from the specific user?
I tried to get the Facebook ID in the start of the game and then order by child like this: (FBid is the facebook id variable)
DataSnapshot userSnapshot =
await FirebaseDatabase.DefaultInstance
.GetReference("Users")
.OrderByChild("FBid")
.EqualsTo(FBid)
.GetValueAsync();
but that didn't work well because I had a hard time requesting in every start the Facebook id, and what I mean by that is that when I call the FB.API in the start of the game I get an error :
400 bad request
which I tried to solve but then I realized that I don't wanna make so many api calls, I wanna do that once and save it in the database, then reuse it from the database everytime.
So, I ran out of ideas, can anyone help me get the data of the user that is playing?
I want to get the user profile data on connect to twitter. I managed to connect and get the access token and access token secret using Tweetsharp Lib. But trying to get the user profile throw an error.
So I want to use the Rest Api and just get the info my self.
I would like to see an example of how to pass the access token and or access token secret. Anybody can help me out please?
I am the developer of Tweetinvi which is a library similar to Tweetsharp but that is maintained and up to date.
You can get a user profile using the following code :
TwitterCredentials.SetCredentials("Access_Token", "Access_Token_Secret", "Consumer_Key", "Consumer_Secret");
var user = User.GetUserFromScreenName("<username>");
I hope this can help you with your code.
Cheers,
Linvi
I see that FQL is deprecated?
We now use the Graph API and with url .
What I want is to get all the latest pictures of my friends and NOT from pages or other stuff.
If I use:
me/home/?filter=app_2305272732
will I also get back pictures from pages and more.
How can I ONLY get pictures of friends.
Since you would need to use the read_stream permission to get friend postings in the stream of the authorized user, and since friend permissions are gone, there is no way to achieve this. You will not get read_stream approved: https://developers.facebook.com/docs/facebook-login/permissions/v2.2#reference-read_stream
Information about the friend permissions are in the changelog: https://developers.facebook.com/docs/apps/changelog
You can only get the latest photos and posts of the authorized user by authorizing him with the user_status permissions and using /me/statuses.
I am new to developing against Facebook. I need to be able to post to other people's walls from my website, which is c#.NET and asp.net. I've already registered a facebook app to do this.
When I press a button on my website, I want to share content to a list of my own users that have provided me with their facebook URLs. They will have granted the FB app permission to their wall.
There's not a lot of information on how to do this. I need to:
Retrieve a new accesstoken, server side, using Facebook SDK.
Given a facebook url, get a user's profile
Share a link to their wall.
i used php and javascript to connect FB SDK. i don't know it can implement to c#
you can get accessToken by FB.getLoginStatus
developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/
you can get some permission for grant what you want by "scope" parameter (look about Graph API)
http://developers.facebook.com/docs/getting-started/graphapi/
share some text to wall(feed) see "Publishing" at Graph API
http://developers.facebook.com/docs/reference/api/publishing/
i hope it help you.
sorry for my English skill.
first download the nuget package or dll from https://github.com/barans/FacebookCsharpSdk
fill the appid and secret from www.facebook.com/developers
var config = new Dictionary<string, object>();
config.Add("appId", "3955.......");
config.Add("secret", "4c1d...............");
config.Add("fileUpload", true); //optional
FacebookClient client = new FacebookClient(config);
this code retrieves the access token
client.getAccessToken();
this code retrieves the current user information which is publicly available. you can replace me with a facebook id like "999999"
client.api("/me", "GET", null));
facebook does not allow server side wall posting to an arbitrary user. you can only post to the current user's wall and first you should ask publish_stream permission. after getting that this piece of code makes a wall post
request.Method = FacebookApiMethodType.POST;
request.Path = "/me/feed";
request.Params = new NameValueCollection();
request.Params.Add("link", "www.arcademonk.com");
request.Params.Add("message", "C# SDK Batch Request Messsage");
you can find the all documentation on github page. hope it helps.
This is a one page site I'm using to understand FB. I'm trying to get FB Connect to work.
I've tried several tutorials, two different domains, and tweaked the app settings on FB. All I seem to be able to get is the above error message.
I've read several answers on this site but my FB app setting don't match the any of the answers.
Thanks!
use should use Facebook rest api.And make sure that you have registered your website at facebook to connect, and you should have ApplicationKey and SecretKey.
and to connect facebook
<fb:login-button onlogin="window.location.reload()"></fb:login-button>
Then for access permission
Collapse | Copy Code
<fb:prompt-permission perms="email"> allow mail permission</fb:prompt-permission>
Add reference facebook api in your project.
ConnectSession connectSession = new ConnectSession
(ConnectAuthentication.ApiKey,ConnectAuthentication.SecretKey);
if(connectSession.IsConnected==true)//you sucessfully connected