FirebaseUI-iOS icon indicating copy to clipboard operation
FirebaseUI-iOS copied to clipboard

Updating to 5.1.2 breaks phone and Google auth

Open lswang1618 opened this issue 8 years ago • 22 comments

Objective C or Swift: Swift iOS version: 11.4 Firebase SDK version: FirebaseCore 5.0.5 FirebaseUI version: 5.1.2 CocoaPods Version: 1.5.2

Step 3: Describe the problem:

Logging in using FirebaseUI with Google stalls on loading after selecting email without useful console messages. Tapping on Phone from the auth picker screen results in . Downgrading to 5.0.0 resolves both issues.

Steps to reproduce:

  1. Tap Sign in with Google

  2. Tap Continue

  3. Select account

  4. Observe stall via progress circle that never ends (although login and upgrade does seem to complete as observed in Firebase Console)

  5. Tap Sign in with phone

  6. Observe crash

Observed Results:

When logging in with Google, no useful errors, just stalled loading. When trying to log in with Phone, results in this crash: screen shot 2018-07-20 at 12 55 47 am

Expected Results:

  • Successful login with either Google or Phone auth

Relevant Code:

            let authUI = FUIAuth.defaultAuthUI()
            // You need to adopt a FUIAuthDelegate protocol to receive callback
            authUI?.delegate = self
            
            let providers: [FUIAuthProvider] = [
                FUIGoogleAuth(),
                FUIPhoneAuth(authUI:FUIAuth.defaultAuthUI()!),
                ]
            authUI?.providers = providers
            authUI?.shouldAutoUpgradeAnonymousUsers = true
    
            let authViewController = authUI?.authViewController()
            present(authViewController!, animated: true, completion: nil)

lswang1618 avatar Jul 20 '18 05:07 lswang1618

Can you provide the full stack trace of the crash?

morganchen12 avatar Jul 20 '18 21:07 morganchen12

I'm able to log in successfully using Google auth in the swift sample app in this repository.

morganchen12 avatar Jul 20 '18 21:07 morganchen12

For phone auth:

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xda9bf7c08)
    frame #0: 0x00000001835bc910 libobjc.A.dylib`objc_msgSend + 16
    frame #1: 0x0000000184e37ddc Foundation`_NSDescriptionWithStringProxyFunc + 64
    frame #2: 0x00000001843acc70 CoreFoundation`__CFStringAppendFormatCore + 8832
    frame #3: 0x00000001843ae740 CoreFoundation`_CFStringCreateWithFormatAndArgumentsAux2 + 132
    frame #4: 0x0000000184d28b88 Foundation`+[NSString stringWithFormat:] + 68
  * frame #5: 0x0000000102c58178 SAT Prep`-[FUIPrivacyAndTermsOfServiceView(self=0x0000000108824200, _cmd="fullPrivacyPolicyAndTOSMessageWithSMSRateInfo") fullPrivacyPolicyAndTOSMessageWithSMSRateInfo] at FUIPrivacyAndTermsOfServiceView+PhoneAuth.m:36
    frame #6: 0x0000000102c58084 SAT Prep`-[FUIPrivacyAndTermsOfServiceView(self=0x0000000108824200, _cmd="useFullMessageWithSMSRateTerm") useFullMessageWithSMSRateTerm] at FUIPrivacyAndTermsOfServiceView+PhoneAuth.m:28
    frame #7: 0x0000000102c510ec SAT Prep`-[FUIPhoneEntryViewController viewDidLoad](self=0x0000000109415d60, _cmd="viewDidLoad") at FUIPhoneEntryViewController.m:136
    frame #8: 0x000000018e006e64 UIKit`-[UIViewController loadViewIfRequired] + 1020
    frame #9: 0x000000018e006a50 UIKit`-[UIViewController view] + 28
    frame #10: 0x0000000102c3655c SAT Prep`-[FUIAuthBaseViewController initWithNibName:bundle:authUI:](self=0x0000000109415d60, _cmd="initWithNibName:bundle:authUI:", nibNameOrNil=@"FUIPhoneEntryViewController", nibBundleOrNil=@"/var/containers/Bundle/Application/206C4E84-BF7C-474B-A104-56E5FEB8D17E/SAT Prep.app/FirebasePhoneAuthUI.bundle", authUI=0x00000001c8079440) at FUIAuthBaseViewController.m:80
    frame #11: 0x0000000102c50bac SAT Prep`-[FUIPhoneEntryViewController initWithNibName:bundle:authUI:phoneNumber:](self=0x0000000000000000, _cmd="initWithNibName:bundle:authUI:phoneNumber:", nibNameOrNil=@"FUIPhoneEntryViewController", nibBundleOrNil=@"/var/containers/Bundle/Application/206C4E84-BF7C-474B-A104-56E5FEB8D17E/SAT Prep.app/FirebasePhoneAuthUI.bundle", authUI=0x00000001c8079440, phoneNumber=0x0000000000000000) at FUIPhoneEntryViewController.m:106
    frame #12: 0x0000000102c50a64 SAT Prep`-[FUIPhoneEntryViewController initWithAuthUI:phoneNumber:](self=0x0000000000000000, _cmd="initWithAuthUI:phoneNumber:", authUI=0x00000001c8079440, phoneNumber=0x0000000000000000) at FUIPhoneEntryViewController.m:95
    frame #13: 0x0000000102c4faf4 SAT Prep`-[FUIPhoneAuth signInWithDefaultValue:presentingViewController:completion:](self=0x00000001c802ee00, _cmd="signInWithDefaultValue:presentingViewController:completion:", defaultValue=0x0000000000000000, presentingViewController=0x000000010940d740, completion=0x0000000102c2f6a8) at FUIPhoneAuth.m:126
    frame #14: 0x0000000102c2f62c SAT Prep`-[FUIAuth signInWithProviderUI:presentingViewController:defaultValue:](self=0x00000001c8079440, _cmd="signInWithProviderUI:presentingViewController:defaultValue:", providerUI=0x00000001c802ee00, presentingViewController=0x000000010940d740, defaultValue=0x0000000000000000) at FUIAuth.m:185
    frame #15: 0x0000000102c3a4ec SAT Prep`-[FUIAuthPickerViewController didTapSignInButton:](self=0x000000010940d740, _cmd="didTapSignInButton:", button=0x0000000109410fd0) at FUIAuthPickerViewController.m:168
    frame #16: 0x000000018e15a64c UIKit`-[UIApplication sendAction:to:from:forEvent:] + 96
    frame #17: 0x000000018e27b870 UIKit`-[UIControl sendAction:to:forEvent:] + 80
    frame #18: 0x000000018e160700 UIKit`-[UIControl _sendActionsForEvents:withEvent:] + 440
    frame #19: 0x000000018e2961a8 UIKit`-[UIControl touchesEnded:withEvent:] + 572
    frame #20: 0x000000018e1dd9e0 UIKit`-[UIWindow _sendTouchesForEvent:] + 2428
    frame #21: 0x000000018e1d2890 UIKit`-[UIWindow sendEvent:] + 3160
    frame #22: 0x000000018e1d11d0 UIKit`-[UIApplication sendEvent:] + 340
    frame #23: 0x000000018e9b2d1c UIKit`__dispatchPreprocessedEventFromEventQueue + 2340
    frame #24: 0x000000018e9b52c8 UIKit`__handleEventQueueInternal + 4744
    frame #25: 0x000000018e9ae368 UIKit`__handleHIDEventFetcherDrain + 152
    frame #26: 0x0000000184397404 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
    frame #27: 0x0000000184396c2c CoreFoundation`__CFRunLoopDoSources0 + 276
    frame #28: 0x000000018439479c CoreFoundation`__CFRunLoopRun + 1204
    frame #29: 0x00000001842b4da8 CoreFoundation`CFRunLoopRunSpecific + 552
    frame #30: 0x0000000186299020 GraphicsServices`GSEventRunModal + 100
    frame #31: 0x000000018e2d1758 UIKit`UIApplicationMain + 236
    frame #32: 0x000000010298026c SAT Prep`main at AppDelegate.swift:15
    frame #33: 0x0000000183d45fc0 libdyld.dylib`start + 4

lswang1618 avatar Jul 21 '18 03:07 lswang1618

Ah, the issue for Google Auth is the line

authUI?.shouldAutoUpgradeAnonymousUsers = true

Is there anything else I need to do to enable auto upgrade?

lswang1618 avatar Jul 21 '18 04:07 lswang1618

The auto-upgrade code should just work automatically. Can you check if this is the case for all Google account logins? It may be an edge case for logins that are already linked to anonymous accounts.

@Yue-Wang-Google FYI

morganchen12 avatar Jul 23 '18 18:07 morganchen12

I was able to log in successfully with shouldAutoUpgradeAnonymousUsers enabled for accounts that were not linked or being linked to anonymous accounts, so this isn't a regression, just a bug in new behavior.

Phone auth didn't crash either. Can you provide the format string that's being passed into the stringWithFormat: call before the crash (or share the project that reproduces the crashes)?

morganchen12 avatar Jul 23 '18 18:07 morganchen12

Ah, the TermsSMS translation string is using a different string format, and it is not updated for languages other than English.

see https://github.com/firebase/FirebaseUI-iOS/commit/1f49c883531295131665ad9af5ebced3301ed713#diff-ba025ad8f89db2a4711d0fb284befb9b

@morganchen12 what should we do in this case?

Yue-Wang-Google avatar Jul 23 '18 18:07 Yue-Wang-Google

We should fix this by updating the string localizations.

The Google auth issue we'll have to investigate separately.

morganchen12 avatar Jul 23 '18 18:07 morganchen12

The patch will fix the crash. original code has stack issue --- it's expecting 3 args from stack but instead gets only 1.

The fix will resolve crashing issue for all languages.

Yue-Wang-Google avatar Jul 23 '18 19:07 Yue-Wang-Google

Reopening since the Google issue still remains.

morganchen12 avatar Jul 23 '18 19:07 morganchen12

can you release a new version for this fix ? @Yue-Wang-Google

wangjiejacques avatar Jul 23 '18 20:07 wangjiejacques

@wangjiejacques the crash fix has been released in 5.1.3.

morganchen12 avatar Jul 23 '18 22:07 morganchen12

Will the fix for Google auto upgrade also be going out soon? And do you know if it also affects upgrade using phone and email?

The expected behavior should be that the user is just signed in to the account that's already linked and the new anonymous user data is no longer used, right?

lswang1618 avatar Jul 25 '18 00:07 lswang1618

@ibru since I think you added most of this functionality, would you possibly know how to address this issue?

lswang1618 avatar Aug 04 '18 02:08 lswang1618

@lswang1618 sorry, I have no idea what could be causing this issue.

ibru avatar Aug 04 '18 13:08 ibru

@lswang1618 I'll take a look at the Google auth upgrade issue this week. It shouldn't affect upgrade with phone and email.

morganchen12 avatar Aug 06 '18 17:08 morganchen12

Thanks Morgan!

lswang1618 avatar Aug 07 '18 13:08 lswang1618

This should be fixed in 5.2.0. Please comment here if it's not and I'll reopen the issue.

Thanks!

morganchen12 avatar Aug 09 '18 22:08 morganchen12

Verified - thanks!

lswang1618 avatar Aug 13 '18 23:08 lswang1618

Ah, not sure what's happening, but providerData is empty when I set auto upgrade to true, but includes auth data when set to false.

lswang1618 avatar Aug 14 '18 01:08 lswang1618