Facebook Connect : GetLoggedInUser() throw "Session key required" exception

Nov 19, 2009 at 2:20 PM

Hi all,

I am trying to implement connect on my website using the toolkit

1. user clicks on fblogin , the OnLogin is onlogin='location.replace("../Connect/Facebook/Default.aspx?connect=1");'

2. In default.aspx following code

protected static Facebook.Rest.Api API;

API.Users.GetLoggedInUser();

 

But this throws me an error, saying session key is required. I know I am missing some thing. I tried

API.Application.Session.Login();

connectSession = new Facebook.Session.ConnectSession(apiKey, secretKey);connectSession.Login();


before getloggedinuser(); Still the error.
Please guide me

Nov 20, 2009 at 10:27 AM

Ok, I got it

I had to explicitly assign session vars to the objects

API.Session.SessionKey = "session key"
            API.Session.SessionSecret = "secret session"