tags:

views:

548

answers:

4

Hi all,

When I implement OAuth in iPhone, I have a dilemma to choose Safari or UIWebView to open the Twitter pages for user authentication? I write some advantage and disadvantage of both case: Using UIWebWeb. The disadvantage is users have to enter their credentials in our application. It's maybe risky phishing. The advantage is this approach will not quit our app.

Using Safari for user to authenticate (this approach automatically callbacks to our application) Addvantage: less risky. Disadvantage: have to quit our app

A good reference link about this: http://fireeagle.yahoo.net/developer/documentation/oauth_best_practice

Which approach do you prefer? Any response is appreciate. Thanks.

+2  A: 

The vast, vast majority of users will not understand or care about the distinction. Do whatever makes their lives easier, or--all else being equal--your life easier. And so long as you are trustworthy (you're not phishing or peeking at their credentials, right?), you'll be providing a good experience and not screwing them over. In this case, I'd use the UIWebView.

quixoto
We are not phishing. but the problem is our app is not well-know. Are users willing to provide their credentials to us? And as fireeagle says: "The user will be guided through auth in the safest manner."
Thanh-Cong Vo
Users will give you their auth details even if your name is "SirScamAlot", as long as you promise to deliver the Twitter they crave.
Kendall Helmstetter Gelner
+1  A: 

I've already implemented this as a drop-in set of classes (open source). Feel free to take a look: http://github.com/bengottlieb/Twitter-OAuth-iPhone

Ben Gottlieb
A: 

The guy who did the Pownce iPhone app a couple of years ago sort of publicly debated with himself about this.

His blog doesn't seem to be up anymore, but basically he implemented it the "right" way as far as OAuth is concerned. Instead of entering credentials inside of the app, Safari was launched and they were entered in there, and then a custom iPhone URL was used as the callback to relaunch the Pownce app. Pretty neat, eh?

Some time later, the developer followed up with a comment that a lot of people were downloading the app but not actually using it. His conclusion? That his brilliant OAuth scheme was to blame. Users were confused by Safari launching and being taken out of the app.

To be honest though? I think the fact that the app was for Pownce, a service that nobody used, was to blame.

I have an app in the app store right now that uses the Foursquare API, which supports both Basic HTTP auth and OAuth. I decided to "do the right thing" and use OAuth. The user enters their credentials directly inside of my app. Am I saving their username and password in plain text anywhere? Nope. But could I be? Sure.

It might sound like I'm arguing for both sides here, but what it really comes down to is that it's very unlikely that your users will know or even care about what OAuth is. It's probably just as unlikely that they will even think twice about putting their credentials into your app. OAuth is great (a hell of a lot better than OpenID) but wasn't designed with the iPhone in mind. It's built to work inside of a web browser. I think the Foursquare API docs put it best when talking about their Mobile/Desktop client OAuth scheme (different from what they want you to do for a web app) - "We provide this mechanism under the assumption that if a user has installed your application on their hardware they, trust it enough to pass through their authentication information to foursquare."

bpapa
Hi bpapa. Thanks for your reply. So you implement OAuth using UIWebView, is that right?
Thanh-Cong Vo
+1  A: 

For the best user experience with destop and mobile application, we should use xAuth: http://docs.google.com/View?id=ddkz8b2q_76d95356mz

Thanh-Cong Vo