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

后端 未结 2 1649
天命终不由人
天命终不由人 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 11:51

    were you testing your app on the simulator or on the device? The reason i ask is because im trying to get the app to stayed logged into fb which it does, sorta...it still pops a fb dialog saying it logged in fine and the user has to click on an OK button.

    I havent had time to test it on the device but i think it may have to do with the fact that with the OAuth 2.0, with 3.2.x or >...if the fb is installed, it uses the fb-app login but if its not installed it uses the safari web login.

    Since simulator doesnt have the fb app installed, it actually uses the safari web login (i humbly deduced) which would otherwise store a cookie and maybe it doesnt do so on the simulator..dunno, im still looking for the answer on that one :)

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题