How to do login with TWRequest in a user friendly manner? - iphone

After having a look at Apple TWRequest class (and example), I was surprised it has no possibilities for presenting a user with a login screen. The only way is to check if a user has entered its credentials with [TWTweetComposeViewController canSendTweet] and if no then give a message like
"Hey, you have manually to go to settings->twitter and enter the credentials. Then you should find and open our app manually and continue on"
I'm wondering does anybody use such crap functionality :) For example, Facebook iOS SDK 3 has implemented Single Sign On (SSO) that opens Safari with Facebook login screen and returns to your app after login... I guess I will need to fallback to old styled twitter integration with a lot of 3rd party stuff.
ps. I would give a try to ShareKit but I need to integrate my app with google+ which is not currently supported in ShareKit.

Related

ios 6: prompt user to log into facebook

I'm using UIActivityViewController to use facebook integration within my app. I've observed that in order for the Facebook option to be displayed in the list of displayed options, the user needs to be logged into Facebook on their device in the settings prior to entering that UIActivityViewController.
I'd like to prompt the user to log into Facebook and allow my app access to their account prior to invoking the UIActivityViewController. Is there a way to prompt the user to log into Facebook on their device (I guess I'm looking for a redirect or hook to the Settings app, with a callback)?
Note: I'd like to avoid using the Facebook SDK, and use the purely Apple supplied framework.
It's not possible with UIActivityViewController.
But you can achieve same function via SLComposeViewController.
I created a forked project OWActivityViewController that implement the same function as Apple's built-in Photos app's share action sheet through SLComposeViewController.
OWActivityViewController use the purely Apple supplied framework, compatible with iOS 5, hope this could help you somehow.

Best practice for Twitter login on iOS5 (xAuth or oAuth with Twitter Framework?)

I want to get timeline from twitter account, and I need to create the login part.
I want to ask what is the best practice for that.
iOS5 twitter api doesn't let me create custom login screen, the user need to go to the setting and get back to my app manually. So, I believe I'd better to use xAuth on login screen.
1.Question
Can I still use twitter framework api on iOS5, even if I use a custom xAuth login feature using library like XAuthTwitterEngine?
initWithOAuthToken:tokenSecret: seems like the one to accomplish this.
If so, I think I can use this method with oAuth login too.
2.Question
If you don't need an access to DM, you'd still better to use xAuth, right?
I didn't understand why lots of twitter clients still use oAuth even though xAuth works better on iPhone until I found out you can't access to users DM with xAuth.
But, my app doesn't need to access DM, so I guess xAuth is the way to go.
I believe this is the good login pattern for iOS5.
Login pattern on iOS5
If users already signed in twitter account on iOS setting, it shows the account, so users don't need to login.
If users is not signed in twitter account on iOS setting, you can login within my app using xAuth like official twitter iPhone app.
MugunthKumar/RSOAuthEngine looks nice to do the above even through it doesn't support xAuth.
1.Question
It seems that you can use initWithOAuthToken:tokenSecret: on ACAccount with xAuth only.
But, it's much difficult to get xAuth access from Twitter nowadays.
2.Question
If I use oAuth and let users to login via safari, users don't need to give their account information to developers. This is more secure for users, and developers don't need to have a burden for important login information of users.
In terms of this security point, it looks like that using iOS5 twitter login account on IOS settings is best option. But, unfortunately you can't let users to jump to settings of iOS from iOS5.1 unless you show the tweet screen.
Conclusion
Since my app supports only iOS5 or higher, and letting users to jump to iOS settings is not a bad idea for security reason instead of creating xAuth login screen within my app or oAuth inside on UIWebview, I ended up letting users to jump to iOS5 settings on login.
Check out the way to do that here. https://stackoverflow.com/a/11267414/743663

iOS 5 Facebook Integration

I am writing an app and for the first time I want to integrate some Facebook SDK functionality. I want to have the user login to their Facebook account, then be able to choose one of their friends to "compete" against in the app.
I am following the instructions on the Facebook developers site for iOS but what I can't seem to figure out is how to present a "login with Facebook" view when the app is launched and then never again while the Facebook SSO is authorized or unless the user logs out of the app.
The example I'll use for this is like the DrawSomething app's workflow for authentication.
Any ideas of how to accomplish this? Tutorials or examples would be awesome! I am using iOS 5 with storyboards for the app if that makes a difference.
Thanks!
-Brian
First authenticate :
Facebook API/SDK integration

When using OpenID login within an iOS app is it better to use Safari for login and then redirect back to app?

I'm building an app that uses OpenID for authentication. I'm giving Google, Yahoo and the general OpenID site as options.
At present, when the user selects a site, I open a UIWebView and the user performs their login with that frame, all within the app.
However, it has struck me that when using UIWebView, you cannot easily show to the user that the connection is over https or that they are indeed at the site I'm claiming they are at. I could be easily harvesting passwords.
Would it be, and I'm looking for opinions on this, be better from a user confidence perspective to actually open Safari when the user selects a login and once they've logged in have Safari direct me back to app?
Thanks
Most people using iOS devices are used to the way Facebook logins work; no URL bar, no nothing. I'd just follow the typical workflow. You could bump out to Safari, and return via a custom URL scheme. However, I think users will think that is more weird. iOS users are not used to being jumped in and out of different apps.
just my 2 cents, it would be also faster if the user has already logged in those services with Safari before.
Prompting out a UIWebView and switching to Safari is using the same amount of steps, so why not?
I thought I'd follow up on this thread to say I'm having difficulties getting the app approved and I think it's because I use the Safari approach. I've had it rejected by Apple twice now because:
"Apps that link to external mechanisms for purchases or subscriptions to be used in the app, such as a “buy" button that goes to a web site to purchase a digital book, will be rejected "
I think it's because I'm launching Safari. I've opened a dispute with Apple and I'll come back with more information once I hear back from them. I really hope a quick change to a UIWebView will help!

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
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.
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 :)