Facebook API - 无效的签名请求.(无效签名.) [英] Facebook API - Invalid signed request. (Invalid signature.)

查看:84
本文介绍了Facebook API - 无效的签名请求.(无效签名.)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm tryng to use Facebook authentication at http://landlordscores.co.uk/account/login.aspx but after logging in with facebook, the callback page displays "Invalid signed request. (Invalid signature.) ". The app ID and secret are correct and no other information seems to be logged. This happens every time I try to log in with facebook.

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

To make the call, I'm using pretty much the exact code as the sample. In the markup:

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

推荐答案

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

Perhaps you have done this already but I have had the same issue and all I had to do was add my app ID and secret to the web.config.

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

In the web.config file, my issue was on this line. Ensuring these are populated and accurate should solve the issue.

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

希望这会有所帮助!

这篇关于Facebook API - 无效的签名请求.(无效签名.)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆