【问题标题】:Facebook API - Invalid signed request. (Invalid signature.)Facebook API - 签名请求无效。 (无效签名。)
【发布时间】:2011-06-11 12:50:39
【问题描述】:

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

编辑: 为了进行调用,我使用了几乎完全相同的代码作为示例。 在标记中:

<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();
    }
}

【问题讨论】:

  • 你能发布你用来拨打电话的代码吗?
  • 谢谢,我已经添加了代码示例
  • 当您说您正在使用示例代码时......您从哪里获得示例?您似乎没有使用 Facebook C# SDK(您的问题已标记此 SDK),并且您的代码未使用 Facebook 在developers.facebook.com/docs/guides/web/#login 推荐的 Javascript SDK/注册插件
  • @Echilon 你看过 Request.Params["signed_request"] 看它是否返回任何东西?还有你使用的是什么版本的 C# SDK?
  • 您是否尝试过使用此页面上的示例代码:developers.facebook.com/docs/plugins/registration?如果您单击该页面上示例上的注册,您将收到一个回显响应,这可能有助于调试您的问题。

标签: asp.net api facebook facebook-c#-sdk


【解决方案1】:

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

在 web.config 文件中,我的问题出在这一行。确保这些已填充且准确应该可以解决问题。

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

希望这会有所帮助!

【讨论】:

    【解决方案2】:

    我想你会发现这与 cookie 有关。

    我正在使用 sdk 中的不同示例网站。我清除了我的 cookie,然后我不再收到该错误。

    【讨论】:

      【解决方案3】:

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

      【讨论】:

      • 在赏金中兑现的相当蹩脚的答案。检查设置是否正确是我在发布之前尝试的第一件事。
      猜你喜欢
      • 2015-11-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-12
      • 2015-04-21
      • 2011-04-25
      • 1970-01-01
      • 2014-10-10
      • 2018-10-07
      相关资源
      最近更新 更多