Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

App not running as a canvas #1

Open
zugaldia opened this issue Sep 16, 2011 · 3 comments
Open

App not running as a canvas #1

zugaldia opened this issue Sep 16, 2011 · 3 comments

Comments

@zugaldia
Copy link
Contributor

It runs well as a standalone app, but when I try to run it as a canvas app (following the instructions here: http://devcenter.heroku.com/articles/configuring-your-facebook-app-as-a-canvas-page) I always get an "Invalid Credentials" error message and then I get redirected to the app domain in heroku, where it seems to work.

I have tried disabling the latest patch (enforcing HTTPS in production) but it doesn't seem to help.

Please let me know if there're any diagnostics you want me to run on the app.

@ewjordan
Copy link

AFAICT, the getHome() function in AppInfo.php just needs to return the Facebook app address if this is running inside the iFrame, rather than the Heroku URL; it also should probably be urlencoded in FBUtils before being added to the string. That "Invalid Credentials" message should probably not be displayed at all when this is running as a canvas app, because we're just waiting to be redirected to the authorization page.

@pamo
Copy link

pamo commented Oct 3, 2011

Thanks ewjordan!

I set up a new heroku environment variable, FACEBOOK_APP_URL, and set it as my canvas page url (apps.facebook.com/appname/).

Then replaced
return ($_SERVER['HTTP_X_FORWARDED_PROTO'] ?: "http") . "://" . $_SERVER['HTTP_HOST'] . "/";
in AppInfo::getHome() with
return ($_SERVER['HTTP_X_FORWARDED_PROTO'] ?: "http") . "://". getenv('FACEBOOK_APP_URL');

Cheers!

P.S. This fix did nothing to prevent the display of the Invalid Credentials message, decided to comment that out for now.It did prevent the app from breaking out of the frame.

adamwiggins pushed a commit that referenced this issue Nov 1, 2011
Using a more permanent session storing mechanism
@catahoulaleopard
Copy link

Hi, I'm having the same problem and I did everything that pamo did -- now my app goes into a loop, I guess getHome() now sends it back to the apps.facebook.com/my_app page, which starts my app, which triggers getHome() again and starts the whole process over. Anyone had this, or am I missing a step in the solution?
THANKS in advance.

Addendum:
I figured my problem out, thanks to a post here:

      http://stackoverflow.com/questions/7208642/canvas-authorization-error-191/7208845#7208845

basically, a line in FBUtils.php referring to
top.location.href= ...
when it should be
window.location.href= ....

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants