Twitter iOS User Login - ios

I've implemented Twitter Login in my iOS app with the following tutorial:
https://dev.twitter.com/twitter-kit/ios/twitter-login
But after I chose a Twitter account when I log in the first time, the app always defaults to this account. I would like to enable users with multiple accounts to select the Twitter account they'd like to log into each time.
How can I re-enable the UIActionSheet that allows the user to select which Twitter account they want to use for login?

There is a method Twitter.sharedInstance.logOut to delete the local Twitter user session. And you also should clear Twitter-related cookies in NSHTTPCookieStorage to prevent using of old credentials in further UIWebView-based login sequence.

The new Twitter Kit 3.0 now supports this flow by default. Every time that login is called, the user will be able to add or change their Twitter account.

Related

iOS 9 Facebook SDK Multiple Users

I have followed the iOS 9 Facebook SDK instruction to the letter and facebook login works great, but the app can only support one Facebook user.
I want to support multiple users, but seem to be stuck with whatever user I first logged in with through the Facebook SDK.
Scenario 1:
If I delete my app from the list of allowed apps on facebook website (in settings) and then activate the Facebook login (provided by the Facebook SDK) in my app, rather than allowing me to login in as a different user it asks if I want to "Continue" loging in as the last user that used the facebook login from my App. If I confirm it reauthorizes the app on my facebook account and logs me in as the last user that logged in. Here is the dialog I get when trying to login in after deleting the app from my facebook account.
Scenario 2: The app has been authorized on my facebook account. I chose to log out in my app. I call the facebook logout as shown
FBSDKLoginManager().logOut()
When I go to log in again using the facebook login button (provided by the Facebook sdk), rather than present me with a new facebook login screen it gives me the following:
I don't want to confirm login as the last user. Hitting cancel does nothing. Hitting confirm logs me in again as the last user.
Question: How do I force the facebook sdk to clear out the last users facebook credentials?
Thanks in advance!!
Logout, than set loginBehavior = FBSDKLoginBehaviorWeb when you login.
Reset Facebook Token Reference - Facebook SDK 4.0
When you set login behaviour to web:
loginManager.loginBehavior = .web
with every login you can auth with new credentials

Twitter / Fabric login button only working once

I'm using, with success the Fabric Login button (TWTRLogInButton, https://dev.twitter.com/twitter-kit/ios-reference/twtrloginbutton).
In my Swift app I can authenticate myself, make calls and all. The only problem is that i've implemented a "Logout" button that calls Twitter.logOut().
As specified by the documentation (https://dev.twitter.com/twitter-kit/ios-reference/twitter) this deletes the local session but does not invalidate the remote session. The effect is that once I'm authenticated and then logged out, if I click the "Login" button again I'm logged-in again with the same user, effectively preventing me from switching user.
Any help?
The logOut is a class method, did you call:
Twitter.sharedInstance().logOut()
The incomplete logout issue you guys are facing is actually more related to iOS persisting system accounts. TwitterKit automatically logs a user in if they were already logged in on iOS. You can workaround this behavioral in the use case of kiosk with these steps:
Login to Twitter in Settings > Twitter
Switch to your app and attempt to login with Twitter
Disallow access to Twitter accounts when the grant access dialog comes up:
This prevents TwitterKit from accessing your system accounts and every user will have to login. Hope this helps!
(Initially Twitter.sharedInstance().logOut() destroys local session...)
use method
[[Twitter sharedInstance] logInWithMethods:TWTRLoginMethodWebBasedForceLogin completion:{}]
Parameter TWTRLoginMethodWebBasedForceLogin
Presents a web view that doesn't use any cached sessions
from Safari. Allows the developer to provide multi-user
functionality with several Twitter accounts.
I came across this problem as well, but it seems that this is how it behaves, Twitter "saves" the credentials on an OS level using Accounts
framework. You can see this here:
go to Settings on your phone -> Twitter and you'll see the account there go into the account and "Delete Account"
once you delete the account you will find that when you launch your app and try to login to twitter now you will be asked to sign in.
Once an account is added there is no way to take out the account, (unless Twitter supports this and makes it public) The User will have to manually go into Settings -> Twitter and delete the account from there to be able to sign in to a different account.
Also i noticed that when you add another account into Twitter, trying to login you will be given a chance to login either account when using
[[Twitter sharedInstance] logInWithCompletion:^(TWTRSession *session, NSError *error)
edit: Upon further Research if the User allows the app to use "Twitter" accounts you are able to access the Accounts Framework and delete the account from there:
https://developer.apple.com/library/mac/documentation/Accounts/Reference/ACAccountStoreClassRef/index.html
Cheers!

iOS7, Sign in and post to twitter without Twitter App/ Add new ACAccount

So I'm trying to integrate twitter with the app I'm working on. The flow I'm looking for is one in which the user is prompted to enter his twitter username and password just once, and then anytime the user wants to post to twitter he can do so by entering text into a textfield and clicking a "send" button - no other hurdles.
I know how to accomplish this if the user already has the twitter app installed with an associated account - you can retrieve the account form the ACAccountStore. But what do you do when the user does NOT have the twitter app installed/no twitter account in ACAccountStore? Is there a way to add a new ACAccount using the username and password I have the user enter in-app?
You can then use the twitter framework for setting the account with in the app or you can force the user directly from with in the app to goto setting and set up an account for twitter..

Enable multiple login(Facebook/twitter/Google+) in iphone app(xcode)

I am developing iphone application which has multiple login like this ex. Facebook,Twitter and Google+. Now i want to enable multiple login for same user.So i have a doubt that what can i do after user sign in with facebook and then twitter(without log out from facebook).I need suggestion like if user is logged in with facebook and then user want to login with twitter then i disable facebook sign in button?
I also have doubt that if in facebook profile user has name like "abc" and in twitter profile user has a name like "xyz" then which information do i keep in database of my app.Do i give priority to user for storing user information in database? like if there is conflict of name then i can give priority to user like 1st priority:facebook 2nd priority:twitter and so on.
Do i have to create seperate UI for setting priority?
To answer your question:
Following parameters are considered:
1) How to support connecting multiple social platforms at the same time (link my Google+, Twitter, and Facebook accounts ala Quara/LinkedIn)?
2)How you would support login / sign up from the major social platforms?
3) How to support multiple logins from a single platform (e.g. login with more than 1 Facebook account)?

Using Twitter api logout on Twitter?

User login my application with oauth, after logout my application but twitter can't do, problem is user twitter account is active.
when that logout my application at the same time logout twitter
twitter api not support this action?
No, the twitter API will not log your users out of twitter.
account/end_session only ends the current API Session. I'm working on an site that requires users to be able to log out and then log back in again with another twitter account. To do that, you have to store multiple access tokens per user and establish one as the current access token. More info in the link below.
http://groups.google.com/group/twitter-development-talk/browse_thread/thread/02e44b27d7ba3661?pli=1
As far as signing out of twitter, it's up to the user to sign into twitter and sign out themselves, which is not ideal if working on a shared computer.
Twitter just closing the session at api ,not close the session on Twitter :)
You'll have to call account/end_session to end the session of the authenticated user on twitter.
Old thread agreed, I just integrated Twitter login in my android app using Fabric. I found the following method
com.twitter.sdk.android.Twitter.logOut
I guess they have implemented it now! I couldn't find any documentation, honestly I've not put too much time into it. But I think logout means what I think it means :)
Twitter does not have api for logout. You can use the session closing api to end the user session.
You can use oauth/authenticate or oauth/authorize and add "force_login=true" parameter. This will prompt the user with a login form.
view this thread

Resources