PaulCapestany
PaulCapestany

Reputation: 276

Loading iPhone webviews as an Facebook SSO authenticated user?

I've successfully integrated the Facebook iOS SDK into my iPhone project, and can make graph requests, so I know that I've got my authentication tokens and permissions working properly.

My problem is that when I try to pass a Facebook url into a UIWebView (to look at someone's profile for example, and then be able to take actions such as sending a friend-request), the webview opens up with a Sign In/Login option again there, which shouldn't happen since my user has already signed in via the FB SDK.

Interestingly, opening a url via openURL launches the Safari app and loads the page as the properly authenticated user... however, then I'm outside of my app:

NSString *url = [NSString stringWithFormat:@"http://m.facebook.com/RobertScoble"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: url]];

So my question is: is there some way of loading a webview via the facebook-ios-sdk as the authenticated user? Or, is there some way to force openURL to not load the page in Safari, but within my webview instead?

Thanks in advance!

Upvotes: 3

Views: 1445

Answers (3)

giff
giff

Reputation: 1730

Here's an answer from another thread...

http://facebook.stackoverflow.com/a/9831872/717418

Upvotes: 1

radarcg
radarcg

Reputation: 26

Additionally, this is not unique to iOS. Using Facebook's Android SDK and SSO will also introduce this awkward user experience. That is, if you use webView-based facebook comments in your native android app, and you use Facebook's SSO, the comments will require the user to authenticate.

As far as I'm concerned, this is a bug in the design of the Facebook mobile SDKs.

NOTE: Choosing the non-SSO, webView authentication model will allow all embedded facebook plugins to work as expected. At least this is the case for Android.

Upvotes: 1

user574535
user574535

Reputation: 81

Unfortunately there is no way you can do this. Facebook site keeps your authentication information (auth token) in a cookie and cookies are not shared between mobile safari and UIWebview within 3rd party apps.

Upvotes: 0

Related Questions