0
讓我先寫我的代碼 string strSigned = Request.Params [「signed_request」]; // JSONObject obj = JSONObject.CreateFromString(strSigned);facebook應用程序重定向到redirect_uri位置
Facebook.FacebookSignedRequest fb = FacebookSignedRequest.Parse(AppSecret, strSigned);
JsonObject jsonObj = fb.Data as JsonObject;
if (!jsonObj.ContainsKey("user_id"))
{
string appId = App_Id;
string redirectUrl = "http://127.0.0.1/Default.aspx"
string redirectstr = "https://www.facebook.com/dialog/oauth?client_id=" + appId + "&redirect_uri=" + redirectUrl + "&scope=email,read_stream";
Page.ClientScript.RegisterStartupScript(this.GetType(), "redirect", "<script>top.location.href='" +redirectstr +"'</script>");
Response.Clear();
}
else
{
Response.Write(jsonObj["user_id"].ToString());
}
上面的代碼運行完美,直到用戶按允許permissions.the應用程序實際上重定向到提到REDIRECT_URI HTTP:...和Facebook之內不留。
我真的很迷惑這個。我知道解決方案。
這是否意味着我應該給redirect_uri作爲我的應用程序url? – 2012-02-23 16:11:25
是的,你可以設置redirect_uri到apps.facebook.com/myapp或者facebook.com/pageurl?sk=app_YOUR_APP_ID – 2012-02-23 16:15:37
這樣做會給我一個未知的錯誤,我是否需要在facebook應用配置中將其他地址放在其他地方? – 2012-02-23 16:18:03