Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS - being logged-in in a webView after logging in with the SDK

I'm building an iPhone app that has some social features. I've managed to get the user to log-in to Facebook within my application. I've also implemented a webview that loads a facebook iPhone-optimized page. What I now want to do is my user to be logged-in within the webview without having to log-in twice (once in the app and once in the webview)

I've tried a few things playing around with the access_token in the URL but it didn't work.

Does anyone know if it is possible to implement that and how to do it?

Thanks in advance for your help

like image 491
saintmac Avatar asked Nov 15 '22 05:11

saintmac


1 Answers

Short answer: You're probably not supposed to be able to do that.

The idea is that your app should only store an authentication token that lets you do stuff as your app (e.g. post to the wall as your app). On the web version, the user is logged in to facebook and facebook additionally passes an authentication token to your website; on the iOS version, I think you never get the Facebook session cookie, and I'm pretty sure you need the Facebook session cookie to be logged in to the web side of things (especially since it's designed for the browser — logging out of Facebook logs you out of Facebook Connect on all sites).

There are loads of things you can do to work around this — it's trivial to just ask the user for a username/password (and the whole idea of a "trusted UI" inside a UIWebView inside your app is flawed, despite Facebook's claims).

The "right" thing to do is to implement everything using calls to the iOS SDK so you don't have to bother with the web side of things.

like image 57
tc. Avatar answered Dec 28 '22 07:12

tc.