How to authenticate multiple entry points in a facebook app?
I am using an IFrame application with XFBML and the n开发者_运维技巧ew Javascript API.
I'd like to have a facebook application with multiple entry points. These will most likely represent different links coming from a fan page tab.
I can do this quite easily if the pages don't require authentication - for instance I can create several pages under the app and if a new user comes I can send them to any page:
http://apps.facebook.com/myapp/offers
http://apps.facebook.com/myapp/game http://apps.facebook.com/myapp/productsThe problem is that if I need to have authentication then once the user is authenticated they get redirected to my default post-authorization url.
Is there a way for a user that comes to /game
to stay on /game
after they are authenticated without redirecting.
I thought I could do it with the AJAX login form - but I cannot find out how to do that in a Facebook IFrame application.
I think the example using requirelogin
only works for FBML.
<a href="http://apps.facebook.com/mysmiley" requirelogin=1> Welcome to my app</a>.
Is there a way to accomplish this with Facebook APIs - or will I have to do some kind of clever cookie handling?
You can use the facebook connect JS library inside of an iframe app and then redirect them to the appropriate url in javascript if they click allow. Best to go to the Facebook dev docs on the Javascript SDK on Fb:login here: http://developers.facebook.com/docs/reference/javascript/
Basically if the login is successful, you will get a callback where you should redirect them in javascript by using window.top.location = 'yoururlhere';
精彩评论