问题
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();
}
}
回答1:
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!
回答2:
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.
回答3:
You must check your app settings on facebook. Take care about the URLs and other settings.
来源:https://stackoverflow.com/questions/6316020/facebook-api-invalid-signed-request-invalid-signature