Can't set RequiresLogin in IFRAME app?

Jul 23, 2009 at 6:47 PM

I can't seem to find where to set RequiresLogin when using CanvasIFrameMasterPage.   base.RequiresLogin or this.RequiresLogin doesn't work.  Some of what I've read seems to indicate that it doesn't exist, that it only exists in the FBML base case, but other things I read seem to indicate that it does...  so I'm no really sure. 

Jul 23, 2009 at 7:26 PM
protected void Page_PreInit(object sender, EventArgs e)
    {
        Master.RequireLogin = true;
    }  
Jul 23, 2009 at 7:33 PM

Have you tried that in 2.1?  I looked at the 2.1 source code and RequireLogin doesn't seem to even be there for CanvasIFrameMasterPage.  Only in some of the latest builds (and perhaps 2.0? I haven't checked) does it seem to be present.

If you have gotten that to work in 2.1 I'll try again. 

 

Jul 23, 2009 at 7:53 PM

I just checked 2.0 and didn't notice it.  Are you sure you aren't thinking of how to do it with FBML pages and CanvasFBMLMasterPage?  RequireLogin is definitely there in 2.1.  But it just doesn't seem to be there in CanvasIFrameMasterPage.

I tried using some of the latest builds, where RequireLogin is present...  but that just presented a whole batch of new problems.  Lots of syntax changes.  But even after I got that working where the home page of the app would at least load in Facebook, clicking on to any other page in the app seemed to kick me out of the Facebook iframe and back to the home page of the app.  Strange.  Hopefully it's a behavior of the beta and not something I'll need to debug when 3.0 is released...

 

Jul 23, 2009 at 8:38 PM
string fb_sig_session_key = Request.QueryString["fb_sig_session_key"];
if (String.IsNullOrEmpty(fb_sig_session_key))
{
    

Response.Write(

"<fb:redirect url=\"http://www.facebook.com/login.php?api_key=[API KEY]&next={YOUR APP]&v=1.0\" />");
}
You can try that
Jul 23, 2009 at 8:42 PM

Thanks for that, I'll have to make note of it for other apps, but I'm actually trying to do the opposite.  The default behavior in the iframe is to require a login - so it already does what you describe.  But in some cases I don't want to require a login.