Login with web view

login
twitterkit

#1

Hi,
I’m trying to force the user to authenticate in a web view rather than the app. I’ve tried using TWTRLoginMethod but it looks like it was removed in the latest TwitterKit. Is there a way to do this now?
Thanks


#2

With Twitter Kit 3.0 we removed the TWTRLoginMethod option for login flow goes from Twitter app, SFSafari, then web.


#3

I understand this was likely removed for valid reasons, but unfortunately it has completely broken the ability to completely log out a user and log in a new one.

Some of our applications are used in a kiosk mode so we are particularly sensitive to this change since we almost never want sessions to persist between uses.

When using the logInWithCompletion method the SFSafariViewController is always used for the first user authenticated. This means that if I’m logging out a user after interacting with Twitter it will always use this method rather than UIWebView However, the previous session cookies are retained since SFSafariViewController is sandboxed on the system level. This means that the first user is remembered even though I’ve logged them out manually with logOutUserID. I have to physically restart the device to get this cookie cleared and there’s no way to clear it manually since SFSafariViewController is sandboxed at the system level.

The only way to get around this is to never log out users in my application. This forces UIWebView behavior for everyone after the first user and ensures that the first user is not logged in automatically. However, the side effect of this behavior is that the user ID of the last user is pre-filled in the “username” field which is disconcerting to the next user.

It would be helpful if we could always force the UIWebView behavior for this very reason like we were able to previously with TWTRLoginMethod. If this isn’t possible, can we at least get the bug fixed where the SFSafariViewController method keeps the previous user’s cookie? What is the benefit of using SFSafariViewController for the first user in this case–wouldn’t it be simpler and more consistent to always use UIWebView if the Twitter app isn’t installed?

A secondary concern is that the SFSafariViewController method adds extra controls at the bottom allowing the user to trigger the share dialogue or open the login page in the installed browser–effectively breaking our kiosk application.

To recap, the current behavior is as follows:

  • We call logInWithCompletion to log in User A
  • They finish interacting with our app and we call logOutUserId to log them out
  • User B attempts to use our app and we call logInWithCompletion again
  • The modal appears briefly and then displays “Redirecting you back to the application”
  • User B never sees a login screen and instead they are signed in as User A
  • Until the phone is physically restarted users are always logged in as User A since they happened to be the first person to login.

#4

Did you find a workaround for this ? I’m facing the exact same issue.


#5

I’m trying to login with that, but every time I do it, i get this error:

CredStore - performQuery - Error copying matching creds.  Error=-25300, query={
    class = inet;
    "m_Limit" = "m_LimitAll";
    ptcl = htps;
    "r_Attributes" = 1;
    sdmn = "https://api.twitter.com";
    srvr = "api.twitter.com";
    sync = syna;
}
2018-03-29 13:12:05.849319-0600 Statkid[367:114209] [TwitterKit] did encounter error with message "Error obtaining user auth token.": Error Domain=TWTRLogInErrorDomain Code=-1 "{"errors":[{"code":32,"message":"Could not authenticate you."}]}" UserInfo={NSLocalizedDescription={"errors":[{"code":32,"message":"Could not authenticate you."}]}}

I configured everything the page indicates, to no avail…