capacitor-community / facebook-login

Facebook Login support
MIT License
103 stars 54 forks source link

iOS Login with the Facebook app installed fails #20

Closed another-novelty closed 3 years ago

another-novelty commented 3 years ago

Describe the bug The AppDelegate function of the FBSDK refuses to handle the returned Intent.

To Reproduce Steps to reproduce the behavior:

  1. Follow the instructions in the Readmes
  2. Install on an iPhone with the FB app installed
  3. Open the login dialog
  4. When asked to open in the native app, do so
  5. Provide authorization, return to app
  6. See, that the dialog is not closed.

Expected behavior The Dialog should close and provide the auth info to the app.

Smartphone (please complete the following information):

Additional context Official Facebook app is required. Authorization through safari works just fine but is disabled when the app is installed. Returned URL is (omitting IDs) fb://authorize#denied_scopes=&granted_scopes=email%2Cpublic_profile&graph_domain=facebook&nonce=&signed_request=&state=%7B%22challenge%22%3A%22xn1%252FW870hI2L16%253D0EtIa87a6Wjo%253D%22%2C%220_auth_logger_id%22%3A%2212F0D8C6--304804A65CA4%22%2C%22com.facebook.sdk_client_state%22%3Atrue%2C%223_method%22%3A%22sfvc_auth%22%7D

lopezasin commented 3 years ago

I have the same problem

rdlabo commented 3 years ago

Did you change AppDelegate.swift ? This work well.

  func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    if CAPBridge.handleOpenUrl(url, options) {
      return FBSDKCoreKit.ApplicationDelegate.shared.application(app, open: url, options: options)
    }
    else{
     return false
    }
  }
another-novelty commented 3 years ago

Yeah, I tried both your method as well as the one provided by Facebook.

FBSDKCoreKit.ApplicationDelegate.shared.application just returns false. Returning true manually also does not close the dialog.

As I said, having the official facebook app installed is mandatory. Authentication with the browser works fine.

another-novelty commented 3 years ago

Ok I think I've got it. The issue was, that I was using the SDK provided by the swift package manager, as is instructed by facebook. I removed the dependency, switched to the cocoa pods and it seemingly worked.

I will test a little bit more, but it would probably be a good Idea to add this to the documentation.