jeduan / cordova-plugin-facebook4

Use the latest Facebook SDK in your Cordova and Ionic projects
Other
764 stars 509 forks source link

Facebook login is not redirecting back to app when you facebook app installed #890

Closed RaghavCoddle closed 3 years ago

RaghavCoddle commented 4 years ago

When I click on social login, it is redirecting to in app web and asking login with facebook App. But when I authenticate using facebook app again redirecting to same screen and its not navigating back to my app.

I am stuck on this screen, again if click on login with facebook App same thing happens. I am not able to login with facebook when I have facebook native app installed. Screenshot 2020-10-16 at 2 04 05 PM

shide1989 commented 4 years ago

Same issue here on iOS.-> "cordova-plugin-facebook4": "^6.4.0", -> https://imgur.com/a/qBlOWgy

YkkJeff commented 4 years ago

I have the same issue on my app... that's a real problem for our customers, I hope this will be fixed soon :(

shide1989 commented 4 years ago

@RaghavCoddle did you find any solution yet ?

shide1989 commented 4 years ago

@RaghavCoddle and for all those having the issue on iOS14/13, we seem to have found a solution : add the following lines in your AppDelegate.swift :

import FBSDKCoreKit
...

    func application(_ application: UIApplication,
                     didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data ,
                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        ...
        ApplicationDelegate.shared.application( application, didFinishLaunchingWithOptions: launchOptions )
        return true
...

    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        // Called when the app was launched with a url. Feel free to add additional processing here,
        // but if you want the App API to support tracking app url opens, make sure to keep this call
         ApplicationDelegate.shared.application( app, open: url, sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String, annotation: options[UIApplication.OpenURLOptionsKey.annotation] )
        return CAPBridge.handleOpenUrl(url, options)
    }

Reference : Step 5 from https://developers.facebook.com/docs/facebook-login/ios/

This should be mentionned in the iOS setup README.md (https://github.com/jeduan/cordova-plugin-facebook4/blob/master/docs/ios/README.md) or elsewhere as a reference for those struggling on this @peterpeterparker @jeduan @Hirbod

RaghavCoddle commented 4 years ago

@RaghavCoddle and for all those having the issue on iOS14/13, we seem to have found a solution : add the following lines in your AppDelegate.swift :

import FBSDKCoreKit
...

    func application(_ application: UIApplication,
                     didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data ,
                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        ...
        ApplicationDelegate.shared.application( application, didFinishLaunchingWithOptions: launchOptions )
        return true
...

    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        // Called when the app was launched with a url. Feel free to add additional processing here,
        // but if you want the App API to support tracking app url opens, make sure to keep this call
         ApplicationDelegate.shared.application( app, open: url, sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String, annotation: options[UIApplication.OpenURLOptionsKey.annotation] )
        return CAPBridge.handleOpenUrl(url, options)
    }

Reference : Step 5 from https://developers.facebook.com/docs/facebook-login/ios/

This should be mentionned in the iOS setup README.md (https://github.com/jeduan/cordova-plugin-facebook4/blob/master/docs/ios/README.md) or elsewhere as a reference for those struggling on this @peterpeterparker @jeduan @Hirbod

@shide1989 great. It's working for me.