How to login to application using user's Twitter account? - ios

How can I create a login page where a user can login using their twitter identity.
I am running iOS7, So I have created a single page app.
I have added Social framework and added
#import <Social/Social.h>
I am wanting to keep the application as streamline as possible so when the application first loads, and loads each time there after I am checking if the user is signed into the app if not then I would like them to sign in using their twitter account.
I will check this here in the app delegate
- (void)applicationDidBecomeActive:(UIApplication *)application
However, I don't know how to sign in using Twitter.
Everything out there at the moment is focused around posting things to Twitter, I don't care about any of that. I want to know about using Twitter to sign into your app. and then what ever relevant issues I need to know. What data should I store to check when the user loads the app in the future etc.

You can follow following tutorial for twitter integration using user account.
http://www.techotopia.com/index.php/An_iOS_7_Twitter_Integration_Tutorial_using_SLRequest
if do you want to make custom twitter login than you can follow following url
http://codegerms.com/login-with-twitter-example-with-ios-tutorial-using-oauth/

Follow these two tutorial
First get access token, for getting access token follow the following tutorial.
http://codegerms.com/login-with-twitter-example-with-ios-tutorial-using-oauth/
Then using access token get account details, for getting account details follow following tutorial
http://codegerms.com/get-user-info-data-twitter-api-example-ios-objective-c/

Related

How to know user has already done Facebook login at iOS app

I am developing iOS App which use Facebook iOS SDK 4.
When user has already done Facebook login, by doing Facebook login the dialog which shows "user has already approved your app" had be displayed.
So, do not show the dialog. I want to know whether the user has already done Facebook login.
Anyone know the good way? I think accessToken is returned if user once had done Facebook login.
FBSDKAccessToken manage current logged user's accessToken.
According to official Facebook Login guide
"FBSDKAccessToken Represents the access token provided by a successful login. Most important, it provides a global +currentAccessToken to represent the currently logged in user."
The currentAccessToken is a convenient representation of the token of the current user and is used by other SDK components (like FBSDKLoginManager).
According to above you can check either user has valid accessToken or not and based on this you can track call login method otherwise just skip to next flow.
In Facebook the access tokens are per user so you can pass them around apps and they will work. In your case if you can ship an access token from another app you will be able to skip the next logging in and use the API normally.
However I think this this thread will help you.
Things are a little bit different with iOS cause I have done a facebook login on Android and got no such issues.

Can i add only a login function to my app? Swift/Parse

I have an app in which i want to only add a logIn button. No signUp.
I am thinking of it like this please tell me if this can work?
SaaS based. So if a business wants to use app, they must sign up on website.
once they do, they can download app where i will give them their logIn Credentials.
Therefore if someone downloads my app from the app store they cannot register unless they are a SaaS customer. Only LogIn with the credentials i provide after signing up and paying for the service.
This being said, if this is doable. i used the parse swift signup code to get my classes working on parse.com
If i go into the users class, i can add new usernames and passwords. (Great!)
If i delete the SignUp code now from my app, and add the LogInUserinBackground code will it still work for logging in users so long as i add their credentials on the Back-End?
Thank you for all responses! Much Appreciated.
Yes, that can and will work.
You can of course remove the ability to create users via the app and only support the creation via the application. Just set the user up via the website, assign the username and password and you are ready to go. Of course you have to create some kind of login form inside the app - what you cannot do is customize the application one user downloads to one specific SaaS customer so that he gets logged in fully automatically. At least once the user has to enter the user credentials in the app.
And as far as I am informed that is even allowed by the app store guidelines - you only have to make sure apple gets a demo account when submitting the app in the end.

RoR Facebook Canvas App user Registraton & Login

I'm currently working on a RoR app that is only going to be used inside the Facebook Canvas. To model the users I use Devise. Now, I'm aiming at making the signup & login process easy as pie. If my prospective users open the app, he/she should be prompted to authorize the app to access name and email. If this happens a user should be created with the name, fb_uid and email. Every time this user now comes back to the canvas app he should be signed in.
How do I accomlish this?
Please help - looked at koala, omniauth, the javascript and php sdks -> my brain just feels fried...
This railscasts episode shows you how to easily put together the authentication system using omniauth-facebook. I actually just used it today as well. Let me know if you have any more specific questions.
http://railscasts.com/episodes/360-facebook-authentication

Facebook iOS SDK and Safari based authentication issue

I have used latest FB SKD in my iOS app so users can use facebook account to login. Application open the FB app and comes back to my app perfectly fine. However, in some place in the app, i have to show/pull some people facebook page (safari based using WebView), but even user already used the Facebook account to login into my native ios app, but the page still ask user to login again and when they click login, it shows them the annoying FB username/pass page.
Is there anyway, that the FB safari based page can authenticate the user since it's already logged into my app using FB integration? do i have to include query or something. Please give me details how to solve this problem since i'm new in this..
thanks again for your help...
pic: https://www.dropbox.com/s/rjlptu7ufpcq3vl/fb.png
When the user switches to Facebook app to authenticate, it doesn't create a cookie for your UIWebView which is why it's asking to login again. Have the user authenticate inside the UIWebView without switching to the Facebook app.
What you're talking about also sounds like a similar thing that happens with Facebook dialogs not knowing about the current Facebook session.
If you authenticate your user via Facebook, try saying the Facebook object itself as an instance variable somewhere in memory so you can access it again (a property on a singleton controller, perhaps?).
Spawning dialogs from an authenticated Facebook object appears to let them use the dialog without reauthenticating iff you have a [FBSession activeSession]. So you'd also have to maintain an active FB session. But I'm not sure if this kind of solution will work since you didn't show specific code for how you're doing your web-based FB fetches.
This question might also prove helpful:
Implement Login with Facebook in iOS 5 and 6

Facebook single sign on in iOS issue

I just run the demo app for the single sign on Facebook and I am getting the following:
And what I want is actually something like this:
I wanted it to not show as a web view, how do I do that?
Please see my answer here (which answers this question):
FaceBook API, login in-app
Please also note my caveat. OAuth was designed to authenticate outside of your application - but in this case, you can make it work inside (but it breaks a core principle of OAuth).
When an app requests authorization or login, the application gets the user's login information via the browser (as you showed in the second image) or, if you have the Facebook app installed, from the Facebook app. It looks like you have the Facebook app installed, so the app automatically pulled the user's information from that app.
Then, for any new app that a user uses, Facebook verifies with the user that the app's requested features are allowed by the user.
Since your device pulled the login info from the Facebook app, the email/password screen is not used and the permissions screen is shown first. Once you allow the features, you should not see that screen again, when you start the app again for that same user.
Modify your Facebook.m
- (void)authorize:(NSArray *)permissions {
self.permissions = permissions;
// with both options NO, authorization always happens in-app
[self authorizeWithFBAppAuth:NO safariAuth:NO];
}

Resources