Can you make Facebook Connect apps span several pages?
I'm building a Facebook Connect application and I'm trying to figure out if I can span it over several pages, or if it all has to live in one page. I think I'm getting an error related to this, but I haven't found a a clear answer from the facebook documentation.
I'd like to have this structure:
http://example.com/app/login.html - An intro page that explains the application and provides an fb login button. If the user is already connected to the application, it provides a link to go to the next page. All this functionality requires use of the facebook js api.
http://example.com/app/app.html - This is the actual application page. Grabs fb user's information, etc.
On the fb application setup page, I've indicated that my app lives 开发者_Go百科at http://example.com/app/app.html. On the login page, when I try to login a user, I get an error saying:
API Error Code: 191 API
Error Description: The specified URL is not owned by the application
Error Message: redirect_uri is not owned by the application
I'm guessing if I switch my app to own http://example.com/app/login.html, app.html will fail in the same way. Can someone explain if what I'm trying to do is possible?
Thanks!
As long as the pages are on the same domain it's fine to have multiple pages.
However, the problem that you might face is that, you might lose the user's session going from a page to another.
The work arounds are:
1) In every page check to see if the user has a facebook session, if not, redirect to facebook login page (The user will get redirected back to your page if he's logged in to facebook) The user don't usually see the redirections, it happens pretty fast.
2) Send the access token OR fb_sig_* to the next page and you don't need the session anymore, with an access_token you can do what you need pretty much.
BTW, the fb setup page usually asks for a directory not a particular page. So make sure you have that setup correctly.
-Roozbeh
精彩评论