views:

1800

answers:

3

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?

A: 

I might be missing something here - but why can't you get them to login again if they want to use the website? That fits the login idea that I think Facebook would also like - the user explicitly permits access in this way.

Is the web site an integral part of your app and you are using it with views in the application? Why do you make users use both?

Grouchal
The website/UIWebView is integral to the app. It is similar to the sample runaround app that matches Facebook users with their running details and compares it with their friends, albeit with a much more involved database.
Why not just do it as a web app?
Grouchal
That would require authentication using either the regular Facebook website or Facebook Connect for web. Facebook Connect for a web app doesn't work with the iPhone though.Oh well, I guess I'll just go with implementing it as a straight Facebook iFrame. Thanks!
+1  A: 

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.

jsd
A: 

Jurek, were you able to solve this using the iFrame? I would very much like to learn from your experience.

I am in a similar situation, where I am writing an iPhone client for a Facebook application. The client does not want to use Facebook connect over the iPhone to avoid reverse engineering of the application secret.

The Facebook application maintains a database of Facebook users' info and would like the iPhone client to communicate using a cookie. How does the site manage the authentication handshake with the iPhone? Would you point me to some resources that can help me with this as well?

Thanks! - Mansi

Mansi