After login, user is redirected to callback URL, instead of the canvas page

Jul 19, 2007 at 3:05 PM
Edited Jul 19, 2007 at 3:14 PM
I am using toolkit v1.2, and I copied the following code from sample. After I click the login button, the browser is redirected to my callback URL (www.<mydomain>.com), instead of canvas page (http://apps.facebook.com/showoff/) where my site is hosted in an iframe. Has anyone else seen this before? I could not find anything wrong in the app settings.

Thanks.

public partial class _Default : CanvasIFrameBasePage
{
new protected void Page_Load(object sender, EventArgs e)
{
base.Api = FACEBOOKAPIKEY;
base.Secret = FACEBOOK_SECRET;
base.Page_Load(sender, e);
......
}
Coordinator
Jul 19, 2007 at 6:46 PM
I have seen it, but I attempted to solve that issue within the IFrameBasePage. Can you post what your callback url, and other app settings are.

(The code in CanvasIFrameBasePage has specific logic to handle this (with the way that redirects are done with javascript)
Jul 19, 2007 at 10:19 PM
I have seen this only when the session expires and facebook needs user to login to my app again. I copied the app settings page to:
http://lht1999.googlepages.com/facebookapp.htm

Thanks for looking into this issue.
Coordinator
Jul 24, 2007 at 10:06 PM
I plan to spend sometime with this tomorrow. I will let you know if I find anything.

Thanks for your patience.
Jul 31, 2007 at 8:52 PM
I got the similar problem, however, I put a break point here:
base.Secret = FACEBOOK_SECRET;

then calls base.Page_Load(sender, e); (loops forever here, dont' know why...)

and found out that mine keeps loading my callback URL (http://localhost:3697/WebSite1/) and then keeps loading this page: http://www.facebook.com/login.php?api_key=ca9e09c8d26592143f1cb4dbe37e824e&v=1.0

and then it switches and loads my callback URL in an infinite loop. I'm running VWD 2005 express edition, and it runs that ASP.NET Deverloper Server locally. Did I do something wrong here?
my web.config:

<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true">
<assemblies>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>

Aug 5, 2007 at 8:42 PM
VWD 2005 express edition will not accept remote requests, so Facebook won't be able to pull your FBML pages from it. I'd suggest using IIS.

Hope that helps
Jon
Jun 13, 2008 at 11:01 AM
I have the same problem with CanvasFBMLBasePage. If i open new browser window and in url write : app.facebook.com/myapp/ than i have redirect to the "https://login.facebook.com/login.php" and after log in, i have redirect to the Call back URL, not to the Canvas page URL as it should be. I think that it something wrong with my application settings in facebook. Can someone help me with this problem?
Developer
Jun 16, 2008 at 8:47 AM
a quick solution for this bug, put this script in your canvas page

<script language="javascript">
        if(location.href.indexOf('your-apps-callback-url') >= 0)
        {
            location.href = "http://apps.facebook.com/your-app-name";
        }
</script>
Jun 16, 2008 at 9:35 AM
Thanks for the script, but i want find a problem why it is not working in my application. It is my facebook application settings or it is toolkit settings.

In the source code i found that class BasePageHelper.LoadFBMLPage() should add get parameters: "canvas", "next=Call_Back_URL" to login_url. May be i'm wrong??

Plaid wrote:
a quick solution for this bug, put this script in your canvas page

<script language="javascript">
        if(location.href.indexOf('your-apps-callback-url') >= 0)
        {
            location.href = "http://apps.facebook.com/your-app-name";
        }
</script>



Jul 26, 2008 at 12:07 AM
Same problem here
Aug 22, 2008 at 6:12 AM
"...should add get parameters: "canvas"..."

That sounds right to me.  I believe allowing us to add the "canvas" parameter to the login.php redirect would resolve everything.  http://developers.facebook.com/documentation.php?doc=auth
Aug 10, 2010 at 7:19 AM
kolianich wrote:
Thanks for the script, but i want find a problem why it is not working in my application. It is my facebook application settings or it is toolkit settings.

In the source code i found that class BasePageHelper.LoadFBMLPage() should add get parameters: "canvas", "next=Call_Back_URL" to login_url. May be i'm wrong??

Plaid wrote:
a quick solution for this bug, put this script in your canvas page

<script language="javascript">
        if(location.href.indexOf('your-apps-callback-url') >= 0)
        {
            location.href = "http://apps.facebook.com/your-app-name";
        }
</script>



 Hi,

I tried your script,but its going to the canvas callback url. Do i need to change anything other than this script.

Please help me regarding this