我想获得当前Facebook用户的Silverlight游戏,不是在.NET页面中托管,只是一个HTML页面。 silverlight游戏将使用他们的id作为提交高分的凭证。获取当前的Facebook用户ID
我不希望他们使用我的应用程序登录Facebook。我希望他们在我的应用程序之外登录Facebook。然后我的应用程序使用Graph API的.Get(“我”)进行检查。但是,.Get(“我”)总是返回null。即使facebookClient具有应用程序访问令牌或appid +秘密。
我正在使用C#facebook sdk版本5.4.1.0(用于SL4支持)。
这是我尝试做使用的appid +秘密:
var app = new Facebook.FacebookClient(appId, appSecret);
app.GetCompleted += new EventHandler<Facebook.FacebookApiEventArgs>(app_GetCompleted);
app.GetAsync("me");
}
void app_GetCompleted(object sender, Facebook.FacebookApiEventArgs e)
{
//the value of me below is always null
var me = e.GetResultData() as IDictionary<string, object>;
string id = (string)me["id"];
}
根据其他网站的应用程序访问令牌应该是绰绰有余,以获得当前的Facebook用户的ID:
- Facebook C# SDK Get Current User
- http://developers.facebook.com/docs/reference/api/user/
- Facebook C# sdk - Does the FacebookApp.Get("me") access to Facebook or just to cookie?
- What is the best way to get the UserId of the current user
- Facebook C# SDK and Access Token
我在做什么错误/误解获取当前的Facebook用户ID?
编辑:调试信息
Fiddler2结果404:
"message": "(#803) Some of the aliases you requested do not exist: clientaccesspolicy.xml",
"type": "OAuthException",
"code": 803
Fiddler2导致400:
"message": "An active access token must be used to query information about the current user.",
"type": "OAuthException",
"code": 2500
FacebookApiEventArgs e.Error.Message:
Value cannot be null. Parameter name: stream
FacebookApiEventArgs e.Error.StackTrace:
at System.IO.StreamReader..ctor(Stream stream, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean leaveOpen)
at System.IO.StreamReader..ctor(Stream stream)
at Facebook.FacebookClient.ProcessResponse(HttpHelper httpHelper, Stream responseStream, Type resultType, String& responseStr, Exception& exception, Boolean& cancelled)
谢谢。看起来需要身份验证才能获取在.Get(“我”) – ShawnFeatherly
Your Welcome :)中找到的任何公共数据:) –