Change App Landing Page - facebook

I have created a facebook app that works properly, but when it is searched for on facebook, the user is redirected to an app landing page (http://www.facebook.com/apps/application.php?id=111111111). How can I make it so that the user is redirected to the app instead (http://apps.facebook.com/myapp/)?
Thanks a lot.

You can check the window's parent location using JS. window.top.location If it's not in the URL that you are expecting then redirect.

Related

Why does 302 redirect does not work in a iframe?

In facebook documentatin page login for canvas, they says:
Because your application is being loaded in an iframe, returning a 302 to redirect the user to the Login Dialog will be unsuccessful.
What is the reason for a 302 redirect not working inside an iframe? Does it mean that if I have any redirect in my app, should I do it via javascript, as they suggest or only this one?
Thanks in advance
Your app is in an iframe on the facebook website. So if they allowed that iframe to open another facebook page, it would look like a "facebook inside of facebook".
When a user loads your app in a canvas page, Facebook sends you a signed_request via POST to that page. You can read about how to handle that in the documentation.

Facebook Canvas Page Redirect

I am currently building a Facebook app but am having some issues with the canvas page. When I click on my app on Facebook, it loads my canvas page url which is 'http://apps.facebook.com/"App NameSpace"'. When the page loads, the text "invalid credentials" is displayed and the page redirects to http://app_name.herokuapp.com/ where my app is displayed and is functional. Why is this redirection occurring and how can I make my app load in the canvas page http://apps.facebook.com/"App NameSpace" ?
Any suggestions would be greatly appreciated.
Thanks.
It seems some problem with your permissions try to use this
facebook official permissions doc

Facebook app as page tab - login redirects to actual website rather than the page tab

I have created a simple Facebook app and added it as a tab page. There is a login button on the page which works, however it redirects to the actual website. I would like the user to be returned to that tab once they have logged in. Is this possible?
URL: https://www.facebook.com/pages/Duaworld-Third-Vision/202611989828272?sk=app_278389335561559
SDK: PHP
Appreciate the help,
Jaap
You could set your redirect URL to something on your site-domain, so it matches the app settings in Facebook and have that URL just issue a 301/302 redirect to send them to the Facebook fan page.

Facebook App: Make the landing page redirect to a URL?

Is it possible to make the landing page (what I understand by landing page: the page the user first sees when they view the FB app or the page they get redirected to after they accepted an invitation to the app, right?) redirect to some URL of my choosing? Like mysite.com/User/Register... would that work or does Facebook not allow that?
You should be able to configure the landing page to be whatever you want it to be. But if that's not an option (maybe you want to track it as a hit to that page or something) you can always redirect whenever you want using top.location.href in an iFrame app, or <fb:redirect url="" /> in FBML.

Facebook canvas Iframe App authentication problem

I am in the conversion process of facebook app from fbml to iframe.
Now i am testing using few iframe pages.
$user = $facebook->require_login();
It gives the current user logged in. Once it get the variable from the facebook.com it saves in cookie by the PHP API provided by facebook).
I logged out using another tab of facebook and i tryed using my app without refreshing the whole site (by just using the links inside my app). It still gives the $user variable.
It indicates that user has logged in instead of user logged out.
Please help me out. I want my app secured.
It looks my iframe app accessible when we select "open this frame in new window".
I need a solution for this too.
Thanks in advance.
You are logged in as far as you are logged in facebook. You will have to create custom PHP's session handling. However, if you want to remove the user from application's cookies, you can do this:
//this will clear cookies for your application and redirect them to a login prompt
$facebook->set_user(null, null);
$facebook->redirect($appcallbackurl);
You can use the JavaScript SDK to subscribe to the logout event via FB.Event.subscribe and reload the page if that happens:
FB.Event.subscribe('auth.logout', function(response) {
setTimeout('window.location.reload()', 0);
});
(Wrapping in setTimeout() is required as a work-around for Firefox.)
To prevent users from using "open this frame in new window," you can check if the page is loaded in an iframe with if(window == window.top) or if the signed_request is available. If not, redirect to the tab URL.