[BUG] Twitter Kit iOS 3.0.4 login sometimes fails to redirect back to host app

ios
auth

#1

On iOS 9, 10 and 11 beta with Twitter Kit 3.0.4 if you initiate a login request when the Twitter app is installed, you will be redirected to the Twitter app for authentication. If the user is not logged into the Twitter app, they will be prompted to login. After logging in, the user is redirected back to the calling app. Sometimes (around 1 out of 5 attempts) after logging in on the Twitter app, Twitter does not redirect back to the calling app. This leaves the calling app in a bad state, waiting for the login completion to be called which never occurs.

Steps:

Pre req: Make sure Twitter app is installed (tested version 7.3.2), but no users are logged in

  1. Make call to Twitter.sharedInstance().logIn
  2. Tap open on the “AppName” wants to open “Twitter” dialog
  3. User is taken to the Twitter app where they are prompted to login
  4. After successfully logging in, the user is redirected back to the original app, where the login completion block is called. Sometimes however, that redirect does not occur, leaving the user in the Twitter app, and the calling app left waiting for a callback that never comes. If the redirect does correctly happen, go to the Twitter app, sign out, and try the steps again. You will get failures around 1 out of 5 attempts.

Sample app: https://www.dropbox.com/s/5c5538v7vyh2ewi/TwitterAuthTest.zip?dl=0
Video showing issue available on request, I didn’t want to post that publicly


TwitterKit 3.0.3 - share same twitter app (consumer key and secret) between multiple apps
Twitter Kit iOS does not authorize account
#2

By the way, this bug is using a manual install of TwitterKit


#3

Have you implemented application:openURL:options: in AppDelegate.m?
https://dev.twitter.com/twitterkit/ios/log-in-with-twitter#handling-log-in-redirect


#4

Yes, I have. Please look at the provided sample app. The Twitter app is sometimes failing to perform the openURL redirect back to the app that is logging in. If you like, I can send you a video of this behavior if you tell me where to send it.


#5

I’d like to know if there will be an upcoming version of the Twitter app with a fix. Can you confirm this is a bug, and that it is being worked on please?


#6

I had the same issue when I debug on the simulator or a device.

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
	if ([[Twitter sharedInstance] application:app openURL:url options:options]) {
		return YES;
	}

The function above is called but always return false. I checked the URL and it seems proper, options seems proper too.
Turned out that I had the TwitterKit in a framework and I shouldn’t call the API directly like that, I should call the framework and the framework should call the Twitter sharedInstance.
Thanks,


#7

I have a similar issue, but it’s 100% of the time because I have multiple iOS apps installed with the same URL scheme for twitter. I’m not sure if it’s related to your bug as well.

Btw I reported it here TwitterKit 3.0.3 - share same twitter app (consumer key and secret) between multiple apps


#8

Issue still exists with Twitter Kit iOS 3.0.4 and Twitter app 7.3.2


#9

The fix didn’t make it to 7.3.2 but will be in on Twitter for iOS 7.4


#10

I can confirm that Twitter (7.3.2) never redirects back to the original app in this circumstance:

  • iOS 10 (possibly 9 and obviously 11 too), we have zero accounts stored in settings
  • Twitter app installed (7.3.2), no account registered in it so far.
  • Trying to link up from our app, the Twitter app opens and we manually enter login information - after this happened Twitter app stays open, showing timeline. The link flow does not complete.

Hoping this is fixed with Twitter 7.4.


#11

This issue still exists with Twitter iOS version 7.4


#12

We also still have this bug in Twitter iOS Version 7.4.


#15

We are facing an issue, please support us on the below.

Twitter Redirection issue.

When user try to login in app using twitter api it redirect user to native twitter app and if user is not already logged in it prompts user to add credentials to login after that some times it fails user to redirected back to the app.

During R&D we found its bug in twitter sdk which sometimes fails to redirect back to source app.


#16

Hey guys, we are working on finding the root cause of the issue. I will provide and update on this thread as soon as discover what the issue is and where the fix will be released.


#17

@RajulArora - Any update on this?


#18

@RajulArora - Any update on this?


#19

@digital_reign It seems to be a bug within the Twitter iOS App. I am coordinating with one of the developers there to get a fix in!


#20

@RajulArora - Issue still exists. Any update on this?
Using TwitterKit (3.1.0) and Twitter app v7.7


#21

One of the developers on the Twitter iOs app is working to get this fixed!


#22

Any update on this?

if ([[Twitter sharedInstance] application:app openURL:url options:options]) {
return YES;
}

Always return false :(, if the twitter app is not installed, everything works. Is there a way to force Web login instead of relying on twitter app as a quick fix for now?