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

后端 未结 2 1648
天命终不由人
天命终不由人 2021-01-13 11:37

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 l

2条回答
  •  一生所求
    2021-01-13 12:09

    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.

提交回复
热议问题