2011-06-11 213 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,然後我停止了那個錯誤。