Facebook C# SDK Get Current User

╄→гoц情女王★ 提交于 2019-12-01 08:45:12

问题


I m working on a Facebook App. Not a website.

I am trying to use Facebook C# SDK and trying to get Current User and Query Current User info. How do i do that?

Also, When i try to use an app it s asking for Adding the app, requesting permission to access data, how do i do that also?

Is there a comprehensive examples of these things?


回答1:


If you're stuck working with .NET 3.5, this will work:

var facebookClient = new FacebookClient(FacebookAccessToken);
var me = facebookClient.Get("me") as JsonObject;
var uid = me["id"];



回答2:


You need the access token. Once you get the access token make a request to me

var fb = new FacebookClient("access_token");
dynamic result = fb.Get("me", new [] { fields = "id" });
var userId = result.id;


来源:https://stackoverflow.com/questions/10094652/facebook-c-sharp-sdk-get-current-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!