roughike / flutter_facebook_login

A Flutter plugin for allowing users to authenticate with native Android & iOS Facebook login SDKs.
BSD 2-Clause "Simplified" License
405 stars 331 forks source link

Use Facebook and Google sign in #204

Open pedro371 opened 4 years ago

pedro371 commented 4 years ago

Hey guys,

how can I use the Facebook and Google sign in an App? In the README stands "[...] If you are using this plugin in conjunction with for example google_sign_in plugin, which also requires you to add CFBundleURLTypes key into Info.plist file, you need to merge them together[...]"

But how I merge them together?

yashdabi commented 4 years ago

Hey @pedro371 Merge info.plist like below, it's working for me

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            // for google
            <string>com.googleusercontent.apps.0000000000000000000000000000</string>
            // for facebook
            <string>fb000000000000000000000</string>
        </array>
    </dict>
</array>
<key>FacebookAppID</key>
<string>000000000000000000000</string>
<key>FacebookDisplayName</key>
<string>xxx</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fbapi</string>
    <string>fb-messenger-share-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>
</array>

google and facebook are working fine in android but in IOS I was getting an error for facebook.

I just solved with this https://github.com/roughike/flutter_facebook_login/issues/195#issue-502849296

import 'dart:io' show Platform;

final facebookLogin = FacebookLogin();
   facebookLogin.loginBehavior = Platform.isIOS
    ? FacebookLoginBehavior.webViewOnly
    : FacebookLoginBehavior.nativeWithFallback;