I am creating a Facebook canvas application that loads in an iframe using Django. I would like the login process to work in the same way that Zynga does. In this method, if you are not logged in, you are redirected to the Facebook login page and then to the application permission page (without pop-ups).
As far as I can tell, Zynga should use FBML and just forward a URL that looks like this:
http://www.facebook.com/login.php?api_key=[api_key†&canvas=1&fbconnect=0&next=[return_url]
In any case, to achieve a similar effect in a python application loaded in an iframe?
There is a method here that shows how to achieve proper redirects using the new php sdk, but I'm trying to use the new python SDK, which only has a method:
def get_user_from_cookie(cookies, app_id, app_secret):
"""
Parses the cookie set by the official Facebook JavaScript SDK.
cookies should be a dictionary-like object mapping cookie names to
cookie values.
...
"""
I have a working code that uses the Javascript SDK and the get_user_from_cookie method:
<div id="fb-root">
<script src="http://connect.facebook.net/en_US/all.js"></script>
</div>
<script type="text/javascript">
FB.init({ apiKey: 'apikey', status: true, cookie: true, xfbml: true});
FB.Event.subscribe('auth.login', function(response) {
window.top.location = 'http://apps.facebook.com/myapp/';
});
</script>
<fb:login-button>Install MyApp</fb:login-button>
The problem with this method is that the user needs to click a button to log in, and then work with the pop-up authentication screens. (Note: a popup also appears if I call FB.login directly)
So ... is there a way to use the javascript SDK to redirect to the login page, and not to load it as a popup?
Thanks for any help! --Eric