darwin-morocho / flutter-facebook-auth

A flutter plugin to add login with facebook in your flutter app
193 stars 127 forks source link

when i installed the facebook app in iphone, facebook login is not worked #116

Closed wangxingxing123654 closed 2 years ago

wangxingxing123654 commented 2 years ago

when i installed the facebook app in iphone, i click the login button, then a dialog will be show , and i click the log in with the Facebook app, and click the continue, it will return to my app, but it's not login.

marslannasr7koncepts commented 2 years ago

Did you resolved it.?

when i installed the facebook app in iphone, i click the login button, then a dialog will be show , and i click the log in with the Facebook app, and click the continue, it will return to my app, but it's not login.

darwin-morocho commented 2 years ago

@wangxingxing123654 and @marslannasr7koncepts please follow the issue template to allow me reproduce the error.

Also you can check the example folder and change the example with your credentials and let me know if the problem persists.

nguyenlinhnttu commented 2 years ago

I'm facing with same problem. Device android installed facebook app can't login. So i try to remove facebook app and login by browser it working. Error on facebook app. https://imgur.com/Rjz9ifp

darwin-morocho commented 2 years ago

I'm facing with same problem. Device android installed facebook app can't login. So i try to remove facebook app and login by browser it working. Error on facebook app. https://imgur.com/Rjz9ifp

This plugin only connect with the native Facebook sdk if you have a wrong configuration in your console I can't do any more. Also go to the oficial Facebook sdk repository and check if other users has the same problem.

junaidlodhi22 commented 2 years ago

having the same problem. If the Facebook app is installed. Facebook giving error. if the Facebook app is not installed, and it opens the Facebook login in the browser then it is working.

darwin-morocho commented 2 years ago

having the same problem. If the Facebook app is installed. Facebook giving error. if the Facebook app is not installed, and it opens the Facebook login in the browser then it is working.

I've tested on my real iPhone X with ios 14.5 without any problem. https://user-images.githubusercontent.com/15864336/127741435-6b476c64-d472-41ac-843b-f2b1442e4a8e.MP4

Maybe is a problem with the facebook sdk for ios the current version in this plugin is 11.0.0 so try to use flutter_facebook_auth:3.4.1 that version use the facebook sdk 9.1.0 first follow the migration guide to avoid problems https://facebook.meedu.app/#/migration-guide next install flutter_facebook_auth:3.4.1

If the problem persists add the next info Describe the bug A clear and concise description of what the bug is.

Environment Add your flutter doctor -v Add your pubspec.yaml Add your Info.plist Add your AppDelegate.swift Add your MainActivity Add your AndroidManifest.xml Add your /app/res/values/strings.xml

To Reproduce Please add your code to reproduce the issue

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots or videos to help explain your problem.

iamjunaidkhokhar commented 2 years ago

it is because you may be adding key hashes with '0x' groups. try to convert you SHA1 key here http://tomeko.net/online_tools/hex_to_base64.php without checking ' remove "0x" groups from input' It worked in my case

jlancer commented 2 years ago

May be iOS [AppDelegate application:openURL:options:] method blocked

My AppDelegate.m

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

flutter-facebook-auth/facebook_auth/ios/Classes/SwiftFlutterFacebookAuthPlugin.swift

public func application( _ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:] ) -> Bool {
    let processed = ApplicationDelegate.shared.application(
        app, open: url,
        sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
        annotation: options[UIApplication.OpenURLOptionsKey.annotation])
    return processed;
}
darwin-morocho commented 2 years ago

May be iOS [AppDelegate application:openURL:options:] method blocked

My AppDelegate.m

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

flutter-facebook-auth/facebook_auth/ios/Classes/SwiftFlutterFacebookAuthPlugin.swift

public func application( _ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:] ) -> Bool {
    let processed = ApplicationDelegate.shared.application(
        app, open: url,
        sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
        annotation: options[UIApplication.OpenURLOptionsKey.annotation])
    return processed;
}

I am not sure because I'm not an objective-c developer for that reason this plugin only works with swift but you can try adding

  [[FBSDKApplicationDelegate sharedInstance] application:application
                                                 openURL:url
                                                 options:options];

in your method

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

for more info go to https://developers.facebook.com/docs/facebook-login/ios?locale=en_US

jlancer commented 2 years ago

objective-c can also work normally, but it doesn’t work if I write it like this

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

so if you use other SDKs, they must be compatible, don't return NO directly, but pass backwards

change to return [super application:app openURL:url options:options]; it works normally

of course, you can also add [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];

darwin-morocho commented 2 years ago

I am closing this because we don't have any response from autor