Another invalid param issue

Jul 5, 2007 at 9:52 PM
Hello,

I've been using the boilerplate authentication code sucessfully for playing around with the dev kit. Today I grabbed the web app I started a couple weeks ago and fired it up in a browser--worked perfectly. Then, when trying to connect to the canvas page, It would bring up the listbox of friends and populate it...but when it does a postback it throws an exception on the_fbService.CreateSession(authToken); Could someone please point out what's wrong here...I don't follow how it works fine with I browse the page in VS, but when I try to use the app it breaks....


protected void Page_Load(object sender, EventArgs e)
{
fbService.ApplicationKey = FACEBOOKAPPKEY;
fbService.Secret = FACEBOOKSECRET;
_fbService.IsDesktopApplication = false;

string sessionKey = Session"facebook_session_key" as String;
userId = Session"facebook_userId" as String;

// When the user uses the facebook login page,
// the redirect back here will have the auth_token in the query params
string authToken = Request.QueryString"auth_token";

if (!String.IsNullOrEmpty(sessionKey))
{
_fbService.SessionKey = sessionKey;
_fbService.UserId = userId;
}
else if (!String.IsNullOrEmpty(authToken))
{

_fbService.CreateSession(authToken);
Session"facebook_session_key" = _fbService.SessionKey;
Session"facebook_userId" = _fbService.UserId;
Session"facebook_session_expires" = _fbService.SessionExpires;
}
else
{
Response.Redirect(@"http://www.facebook.com/login.php?api_key=" +
_fbService.ApplicationKey + @"&v=1.0");
}

.....................
Coordinator
Jul 5, 2007 at 10:23 PM
2 thoughts. If you are trying to do a canvas page, I strongly suggest using the Canvas Base Pages available in the 1.2 release (which will be officially released tomorrow). This will handle all of the authentication logic for you. (as it is definitely more involved than what you are doing here since FBML and IFRAME canvases can't really use Response.Redirect)

The other thought is verify that your application in facebook is configured as web site. And verify your secret and api key.This error on CreateSession indicates that one of AuthToken, API or Secret are not valid.