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

Login with Facebook does work with the browser but not with the app

Open Johnson145 opened this issue 5 years ago • 5 comments

Step 2: Describe your environment

  • Objective C or Swift: Swift
  • iOS version: 13.3
  • Firebase SDK version: 6.6.2
  • FirebaseUI version: 8.4.1
  • CocoaPods Version: 1.8.4

Step 3: Describe the problem:

When logging in with a Facebook account, it does only work if the Facebook app is not installed. Using the redirection from the browser works just fine. Only the app redirection is broken. Coming back from the Facebook app to our app just doesn't trigger anything.

Steps to reproduce:

  1. Ensure that the Facebook app is installed on your device.
  2. Open the browser and ensure that you're not logged in on Facebook.
  3. Initiate the login process using Firebase UI.
  4. The browser popups and shows the Facebook website.
  5. You're getting asked whether you want to open this website in the Facebook app. Confirm.
  6. Log in by using the Facebook app.

Observed Results:

  • The Facebook app opens your app again
  • But the browser / webview is still visible (asking you whether to proceed in the Facebook app) and hasn't changed
  • Closing the webview reveals the Firebase UI login screen
  • Closing the Firebase login screen does not show any logged-in user

Expected Results:

  • The Facebook app opens your app again
  • The webview is closed already (or does so automatically)
  • The Firebase UI login screen is closed already (or does so automatically)
  • Our app receives a valid login callback

Further notes

It's not a new setup. We've integrated Firebase UI into our app a while ago and tested this behavior at that time. Something may have changed in between (e.g. cause of a Firebase or a Facebook update). Originally, the Facebook app was completely ignored, even though it was installed and so the issue didn't appeared earlier.

Johnson145 avatar Mar 03 '20 17:03 Johnson145

Can you test login with just the Facebook SDK (without FirebaseUI)? We've seen some similar issues that ended up being issues in the Facebook SDK.

morganchen12 avatar Mar 03 '20 17:03 morganchen12

I had some problem. and solved it. You check out that Xcode 11, Swift 5, iOS 13 has replaced "AppDelegate"'s func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool with "SceneDelegate"'s func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>).

Here is the completed description:

import FBSDKLoginKit
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
        guard let url = URLContexts.first?.url else {return}
        ApplicationDelegate.shared.application(UIApplication.shared, open: url, sourceApplication: nil, annotation: [UIApplication.OpenURLOptionsKey.annotation])
}

sera4am avatar Aug 06 '20 11:08 sera4am

There is a bug in the Google example a) I do not use Scenes b) the correct way to handle this is : func application( _ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:] ) -> Bool { UIApplication.shared.applicationIconBadgeNumber = 0 guard let firebaseUI = FUIAuth.defaultAuthUI() else { return false } let sourceApplication = options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String let handled = firebaseUI.handleOpen(url, sourceApplication: sourceApplication) return handled }

The sourceApplication param is optional in the FUIAuth

galblank avatar Jul 01 '21 23:07 galblank

Same problem

ggerminiani avatar Jul 13 '21 02:07 ggerminiani

Hi we came across this issue as well, are there any updates to this as this makes Facebook Login unworkable from firebase?

harnit-bakshi avatar Apr 07 '22 05:04 harnit-bakshi