Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook API - Invalid signed request. (Invalid signature.)

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.

Edit: 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>

In the code-behind:

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();
    }
}
like image 702
Echilon Avatar asked Jun 11 '11 12:06

Echilon


2 Answers

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.

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" />

Hope this helps!

like image 108
Jake Sankey Avatar answered Oct 17 '22 01:10

Jake Sankey


I think you will find this has something to do with cookies.

I was playing around with the different sample web sites that have in the sdk. I cleared my cookies and then I stopped getting that error.

like image 29
superlogical Avatar answered Oct 17 '22 01:10

superlogical