Iphone – Login problems for an iPhone Application for a Facebook Connect Site

facebookiphone

I'm writing an iPhone app that provides access to a website that has an existing user database. The website is using Facebook APIs to also allow Facebook users to link their existing accounts with their website accounts.

I need to be able to log in both Facebook and website accounts on my website when using our iPhone client but I am running into some problems:

A. Facebook Connect for the iPhone:
The iPhone App is aware that I'm logged into Facebook; but the website application is not. Therefore the website application has no access to my friends list and can't tell which website users are actually my friends. I could pass it manually from the iPhone to the website but this is awkward and presents some security challenges as well as bandwidth challenges for large friends lists.

B. Facebook Connect via PHP:
This would be the ideal situation as I have full control over the website and can just let the user login through a UIWebView. However, logging in to a Facebook Connect website using an iPhone is borked. The iPhone opens a second tab for the xd_receiver.htm page and does not navigate back to the application page. Check out the sample Facebook Connect site using an iPhone: http://www.somethingtoputhere.com/therunaround.

C. A straight out Facebook Application
This severely breaks the appearance of our iPhone application due to the Facebook frame around the application and hampers usability.

What is the correct way for our iPhone application to access a website using Facebook logins and have the web server be aware of our friends list?

Best Answer

You can pass the sessionKey from the FBSession on the iPhone over to the web server. The web server can then get the user's friends list as if the user had logged in to the web site.