CreateSession redirects

Feb 3, 2008 at 11:04 PM
Hi!

Im trying out the Web sample app, but getting a problem at CreateSession. The call does not seem to return, instead it redirects to the callback URL so the session variables never get set.
Any ideas on what Im doing wrong?

Best regards,
Stefan

Code snippet from the sample:

...
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

' ApplicationKey and Secret are acquired when you sign up for
_fbService.ApplicationKey = "xxx"
_fbService.Secret = "yyy"
_fbService.IsDesktopApplication = False

Dim sessionKey As String = TryCast(Session("facebooksessionkey"), String)
Dim userId As String = TryCast(Session("facebook_userId"), String)

' When the user uses the facebook login page, the redirect back here will will have the auth_token in the query params
Dim authToken As String = Request.QueryString("auth_token")

' We have already established a session on behalf of this user
If (Not String.IsNullOrEmpty(sessionKey)) Then
_fbService.SessionKey = sessionKey
_fbService.UserId = userId
' This will be executed when facebook login redirects to our page
ElseIf (Not String.IsNullOrEmpty(authToken)) Then
_fbService.CreateSession(authToken)
'The code after this point
'is never executed
Session("facebooksessionkey") = _fbService.SessionKey
Session("facebook_userId") = _fbService.UserId
Session("facebooksessionexpires") = _fbService.SessionExpires
' Need to login
Else
Response.Redirect("http://www.facebook.com/login.php?api_key=" & _fbService.ApplicationKey & "&v=1.0")
End If
...
Feb 4, 2008 at 5:16 AM
Hi,
I am having the same problem also. When I try to debug it, I kept on getting the exception error "The underlying connection was closed: An unexpected error occurred on a receive.". I tried locally (debug) as well as place it in another different IP, I am still getting the same exception. I am currently using version 1.6.
Feb 4, 2008 at 5:53 AM
Hi,
I'm getting the same error as Daren and I am also using v 1.6. Could be an endless redirect loop caused by CreateSession when your Callback URL contains the CreateSession call.
Strange if this is a bug, since everyone new to Facebook Web interface would run into it.
I hope there is a simple explanation, something misconfigured!

Best regards,
Stefan
Feb 4, 2008 at 3:23 PM
I have same problem from this morning (my application was working last week). I tryed ver 1.3, ver 1.5 and ver1.6 but still got same error.
Does Facebook change something?
Feb 5, 2008 at 12:55 AM
Hi,
I am still having the same problem today. Any idea what is going on? or how should I go about to resolve this problem? Any help is really appreciated.

Daren
Feb 5, 2008 at 5:10 AM
Hi,
Me to. Not solved yet and no hint.
User Elmar has logged Issue # 9279 "Authentication broken" under the Issue Tracker tab.
I think we have the same problem. Vote for tha issue to raise the urgency for some guru in the development team to fix it.
Here is an URL to the issue-page:
http://www.codeplex.com/FacebookToolkit/WorkItem/View.aspx?WorkItemId=9279

Best regards,
Stefan
Feb 5, 2008 at 8:23 PM
Hi again!

For some reason it seems to work today!
I haven't changed the code.

Best regards,
Stefan