Problem only when setting isdekstopapplication

Jun 29, 2007 at 8:51 PM
Hi guys,

I'm new to this facebook API. I successfully created a winforms facebook app. When trying to do a webforms app, it works only when I don't set the isdesktopapplication (to false). When I do set that variable, I get an excaption. Here's the code:


Partial Class _Default
Inherits System.Web.UI.Page

Private _fbService As New Facebook.Components.FacebookService()


Protected Sub page_load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
_fbService.Secret = "5e03e6a2416d27082d424f43a2e1ed31"
_fbService.ApplicationKey = "e0a1d9cebc19a76106d8f7aed19e635a"
_fbService.IsDesktopApplication = False

Dim sessionkey As String = TryCast(Session("Facebooksessionkey"), String)
Dim userID As String = TryCast(Session("Facebook_userId"), String)

Dim authtoken As String = Request.QueryString("auth_token")

If (Not String.IsNullOrEmpty(sessionkey)) Then
_fbService.SessionKey = sessionkey
_fbService.UserId = userID
ElseIf (Not String.IsNullOrEmpty(authtoken)) Then

_fbService.CreateSession(authtoken)
Session("Facebooksessionkey") = _fbService.SessionKey
Session("Facebook_userID") = _fbService.UserId
Session("Facebooksessionexpires") = _fbService.SessionExpires
Else
Response.Redirect("http://www.Facebook.com/login.php?api_key=" & _fbService.ApplicationKey & "&v=1.0")
End If

If Not IsPostBack Then
Dim k As System.Collections.ObjectModel.Collection(Of Facebook.User)
FriendList1.Friends = _fbService.GetFriends()
End If
End Sub
End Class

After the login completes, the exception occurs on the line:
FriendList1.Friends = _fbService.GetFriends()
The exception states: Incorrect signature
Stack trace:
at Facebook.Components.FacebookService.ErrorCheck(XmlDocument doc)
at Facebook.Components.FacebookService.LoadXMLDocument(String rawXML)
at Facebook.Components.FacebookService.GetFriends()
at Default.pageload(Object sender, EventArgs e) in C:\Documents and Settings\useracct\Desktop\FBWeb\Default.aspx.vb:line 33
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Again, if I comment out _fbService.IsDesktopApplication = False it runs fine. Has anyone else seen this?

Also, am I right that I should be, during testing, setting the facebook callback url to be "localhost:port/app"? has anyone had issues with the web server port changing and having to resynch on facebook's end?

Best,

-Ben
Coordinator
Jun 29, 2007 at 10:49 PM
What is your developer account set up as?

Did you switch your account over from a desktop application to a web application? The api key and secret are not handled the same. So, you need to either get a new key and secret for your web application or at least change your developer account over to a web applciation.

Invalid signature is caused by signing the parameters with the wrong secret.
Jul 1, 2007 at 11:30 PM
Thanks! That was the problem.


rpowers119 wrote:
What is your developer account set up as?

Did you switch your account over from a desktop application to a web application? The api key and secret are not handled the same. So, you need to either get a new key and secret for your web application or at least change your developer account over to a web applciation.

Invalid signature is caused by signing the parameters with the wrong secret.