2011-06-11 210 views
6

我尝试使用Facebook身份验证http://landlordscores.co.uk/account/login.aspx,但在用Facebook登录后,回调页面显示“Invalid signed request。(Invalid signature。)”。应用程序ID和密码是正确的,没有其他信息似乎被记录。每当我尝试使用Facebook登录时都会发生这种情况。Facebook API - 无效的签名请求。 (无效签名。)

编辑: 为了打电话,我使用了几乎与样本一样的确切代码。 在标记:

<iframe src="<%= this.RegistrationUrl %>" 
         scrolling="auto" 
         frameborder="no" 
         style="border:none" 
         allowTransparency="true" 
         width="100%" 
         height="500"> 
        </iframe> 

在后台代码:

public string RegistrationUrl { 
    get 
     { 
    var url = string.Format(
    "http://www.facebook.com/plugins/registration.php?client_id={0}&redirect_uri={1}&fields={2}", 
    FacebookApplication.Current.AppId, 
    HttpUtility.UrlEncode(AppBLL.GetAbsoluteURL("~/Account/fbregcallback.aspx")), 
    HttpUtility.UrlEncode("[{\"name\":\"name\"},{\"name\":\"email\"},{\"name\":\"location\"},{\"name\":\"password\",\"view\":\"not_prefilled\"},{\"name\":\"captcha\"}]"));   this.RegisterUser.ContinueDestinationPageUrl = this.Request.QueryString["ReturnUrl"]; 
    this.hdnPassLength.Value = Membership.MinRequiredPasswordLength.ToString(); 
          HttpUtility.UrlEncode("[{\"name\":\"name\"},{\"name\":\"email\"},{\"name\":\"location\"},{\"name\":\"password\",\"view\":\"not_prefilled\"},{\"name\":\"captcha\"}]"));  
    this.hdnPassLength.Value = Membership.MinRequiredPasswordLength.ToString(); 
    } 
} 
+0

你可以发布你用来打电话的代码吗? – bkaid 2011-06-11 15:31:34

+0

谢谢,我添加了一个代码示例 – Echilon 2011-06-13 17:18:37

+0

当你说你正在使用示例代码...你在哪里得到你的示例?您似乎没有使用Facebook C#SDK(您的问题有此SDK标记),并且您的代码不使用Facebook推荐的JavaScript SDK /注册插件https://developers.facebook.com/docs/guides/网络/#登录 – 2011-06-26 13:45:27

回答

4

也许你已经这样做了,但我有同样的问题,我所要做的就是将我的应用程序ID和密码添加到web.config中。

在web.config文件中,我的问题是在这一行。确保这些内容丰富且准确,可以解决问题。

<facebookSettings appId="xxxxxxxx" appSecret="xxxxxxx" cookieSupport="true" /> 

希望这有助于!

-2

您必须在Facebook上查看您的应用程序设置。注意URL和其他设置。

+1

慷慨的回报现金在赏金。检查设置是否正确是我在发布之前尝试的第一件事。 – Echilon 2011-06-28 18:18:31

1

我想你会发现这与饼干有关。

我正在玩sdk中的不同示例网站。我清除了我的cookies,然后我停止了那个错误。