darwin-morocho / flutter-facebook-auth

A flutter plugin to add login with facebook in your flutter app
197 stars 141 forks source link

It will always be LoginStatus.cancelled. #408

Open ttb-inc opened 5 months ago

ttb-inc commented 5 months ago

What version are you using?

flutter_facebook_auth: 7.0.0

What OS and version are you using to local deploy your application?

macOS Somoma 14.4.1

What platforms are you seeing the problem on?

iOS

pubspec.yaml

name: ttb_auth
description: A new Flutter package.
version: 0.0.1
homepage: ''
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

environment:
  sdk: '>=3.0.0 <4.0.0'

dependencies:
  flutter:
    sdk: flutter

  flutter_facebook_auth: 7.0.0          # https://pub.dev/packages/flutter_facebook_auth/versions

  google_sign_in: 6.2.1                 # https://pub.dev/packages/google_sign_in/versions

  firebase_auth: 4.19.5                  # https://pub.dev/packages/firebase_auth/versions

dev_dependencies:
  #  flutter_test:
  #    sdk: flutter

  flutter_lints: 4.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:
  assets:
    - assets/
    - assets/images/
    - assets/translations/

# To add assets to your package, add an assets section, like this:
# assets:
#   - images/a_dot_burr.jpeg
#   - images/a_dot_ham.jpeg
#
# For details regarding assets in packages, see
# https://flutter.dev/assets-and-images/#from-packages
#
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware

# To add custom fonts to your package, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
#   - family: Schyler
#     fonts:
#       - asset: fonts/Schyler-Regular.ttf
#       - asset: fonts/Schyler-Italic.ttf
#         style: italic
#   - family: Trajan Pro
#     fonts:
#       - asset: fonts/TrajanPro.ttf
#       - asset: fonts/TrajanPro_Bold.ttf
#         weight: 700
#
# For details regarding fonts in packages, see
# https://flutter.dev/custom-fonts/#from-packages

Describe the Bug

Hi,

The screenshot below is a test with two different accounts.

‘1st_img’ returns ‘LoginStatus.success’ as normal, although there is a warning. ‘2nd_img’ has no warning text, but always returns ‘LoginStatus.cancelled’.

What is the difference between the two accounts?

It may be unrelated to the contents of the package. What is the difference between warnings and no warnings?

Thank you.

1st_img

photo_2024-05-23_14-53-28

2nd_img

photo_2024-05-23_14-53-32

Expected Behavior

I want all accounts to receive 'LoginStatus.success' as normal.

To Reproduce

The app is the same, the results are just different for different accounts.

Relevant log output

None.

flutter doctor -v

/Users/jeonglockpark/Desktop/work/flutter_sdk/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, 3.22.0, on macOS 14.4.1 23E224 darwin-arm64, locale ko-KR)
    • Flutter version 3.22.0 on channel stable at /Users/jeonglockpark/Desktop/work/flutter_sdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5dcb86f68f (11 days ago), 2024-05-09 07:39:20 -0500
    • Engine revision f6344b75dc
    • Dart version 3.4.0
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/jeonglockpark/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.89.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Network resources
    • All expected network resources are available.

• No issues found!
Process finished with exit code 0

Info.plist (iOS)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CADisableMinimumFrameDurationOnPhone</key>
    <true/>
    <key>CFBundleDevelopmentRegion</key>
    <string>$(DEVELOPMENT_LANGUAGE)</string>
    <key>CFBundleDisplayName</key>
    <string>[개발]다오패스</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>daopassdev</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>$(MARKETING_VERSION)</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>com.googleusercontent.apps.XXXXXXXXXX01-6jecpXXXXXXXXXXkem3c44bfvmbdr2mc</string>
            </array>
        </dict>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>metastardaopassdev</string>
            </array>
        </dict>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>kakao6f692678bdXXXXXXXXXX8a2934335ab0</string>
            </array>
        </dict>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fb625654292582743</string>
            </array>
        </dict>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>metastar.daopass.dev</string>
            </array>
        </dict>
    </array>
    <key>CFBundleVersion</key>
    <string>$(CURRENT_PROJECT_VERSION)</string>
    <key>FacebookAppID</key>
    <string>625654292582743</string>
    <key>FacebookClientToken</key>
    <string>0cdf34aXXXXXXXXXXXXXXXXXXXX41d91</string>
    <key>FacebookDisplayName</key>
    <string>[Dev] DAOPASS]</string>
    <key>FirebaseAppDelegateProxyEnabled</key>
    <false/>
    <key>ITSAppUsesNonExemptEncryption</key>
    <false/>
    <key>KAKAO_APP_KEY</key>
    <string>6f692678bdXXXXXXXXXX8a2934335ab0</string>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>kakaolink</string>
        <string>kakaotalk</string>
        <string>kakao6f692678bdXXXXXXXXXX8a2934335ab0</string>
        <string>kakaokompassauth</string>
        <string>storykompassauth</string>
        <string>fbapi</string>
        <string>fb-messenger-share-api</string>
        <string>fbauth2</string>
        <string>fbshareextension</string>
    </array>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
        <key>NSAllowsArbitraryLoadsInWebContent</key>
        <true/>
    </dict>
    <key>NSAppleMusicUsageDescription</key>
    <string>Sound can be used.</string>
    <key>NSBluetoothAlwaysUsageDescription</key>
    <string>Can check the network connection status.</string>
    <key>NSBluetoothPeripheralUsageDescription</key>
    <string>Can check the network connection status.</string>
    <key>NSCalendarsUsageDescription</key>
    <string>Can use the function to show the date.</string>
    <key>NSCameraUsageDescription</key>
    <string>Can use the function to read QR Code.</string>
    <key>NSContactsUsageDescription</key>
    <string>Can use the function to tell the location.</string>
    <key>NSFaceIDUsageDescription</key>
    <string>Bio-certification is available.</string>
    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>Location information permission is required.(Receive location information at all times or while using the app.)</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>Location information permission is required.(It always receives location information.)</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Location information permission is required.(You receive location information only while using the app.)</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>Voice can be used when using the camera.</string>
    <key>NSMotionUsageDescription</key>
    <string>Can use the function to tell the location.</string>
    <key>NSPhotoLibraryAddUsageDescription</key>
    <string>Can use the function to download and save captured photos.</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>Can use the profile and photo upload function.</string>
    <key>NSSpeechRecognitionUsageDescription</key>
    <string>Can use the voice recognition function.</string>
    <key>UIApplicationSupportsIndirectInputEvents</key>
    <true/>
    <key>UIBackgroundModes</key>
    <array>
        <string>fetch</string>
        <string>remote-notification</string>
    </array>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UIStatusBarHidden</key>
    <false/>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
    </array>
    <key>UIUserInterfaceStyle</key>
    <string>Light</string>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <true/>
</dict>
</plist>

Podfile (iOS)

# Uncomment this line to define a global platform for your project
platform :ios, '15.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

target 'NotificationService' do
  use_frameworks!
  pod 'Firebase/Messaging'
end

pod 'GoogleUtilities'

AndroidManifest.xml

No response

MainActivity.java

No response

MainActivity.kt

No response

index.html

No response

Info.plist (macOS)

No response

ZhiyongPan commented 5 months ago

same

danbil24 commented 5 months ago

same issue facing

darwin-morocho commented 5 months ago

@ZhiyongPan @ttb-inc @danbil24 if you are upgrading from a previous version of 7.x.x try running

cd ios && pod update flutter_facebook_auth
darwin-morocho commented 5 months ago

@ttb-inc please follow the issue template and add your code or some repo to reproduce the issue

ttb-inc commented 5 months ago

@ttb-inc please follow the issue template and add your code or some repo to reproduce the issue

Thank you for your response. Is there any more information you need?

ttb-inc commented 5 months ago

@ZhiyongPan @danbil24 Please share any information you have to resolve this issue.

RahulRai9044 commented 5 months ago

@ttb-inc facing same issue with the latest ios versions .

zamargab commented 5 months ago

Facing same issue, works on Android but not on IOS

petodavid commented 5 months ago

Same here, Android works fine, iOS has the same issue

devmax12 commented 5 months ago

Same iOS always cancelled login

petodavid commented 5 months ago

@darwin-morocho do you have any suggestions? As I see this is affecting a lot of people on iOS (Android works fine). On iOS loginResult.status == LoginStatus.success is never true, I'm talking about a published live Facebook app.

 try {
      final rawNonce = generateNonce();
      final nonce = sha256ofString(rawNonce);
      final loginResult = await FacebookAuth.instance.login(loginTracking: LoginTracking.limited, nonce: nonce);
      if (loginResult.status == LoginStatus.success) {
        final token = loginResult.accessToken?.tokenString;
        if (token == null) return Error(FacebookSignInFailure());
        late OAuthCredential facebookAuthCredential;
        if (loginResult.accessToken is LimitedToken) {
          facebookAuthCredential = OAuthProvider('facebook.com').credential(idToken: token, rawNonce: rawNonce);
        } else {
          facebookAuthCredential = FacebookAuthProvider.credential(token);
        }
        await firebaseAuth.signInWithCredential(facebookAuthCredential);
        return currentUser(reload: true);
      }
      debugPrint(loginResult.message);
      return Error(FacebookSignInFailure());
    } on FirebaseAuthException catch (e) {
      debugPrintStack(stackTrace: e.stackTrace, label: e.toString());
      return Error(FacebookSignInFailure());
    } catch (e) {
      debugPrint(e.toString());
      return Error(FacebookSignInFailure());
    }
petodavid commented 5 months ago

@ttb-inc did you find a solution?

ttb-inc commented 5 months ago

@ttb-inc did you find a solution?

Not found. We are discussing removing facebook from the app.

lucavenir commented 5 months ago

We've decided to integrate iOS' facebook sdk ourselves because of this issue as well. Unluckily simply removing the facebook sign in for our users isn't option for us.

dmitry-mikheev commented 5 months ago

We've decided to integrate iOS' facebook sdk ourselves because of this issue as well. Unluckily simply removing the facebook sign in for our users isn't option for us.

You think the problem lies within the flutter_facebook_auth package? The reason could be with the facebook SDK itself actually...

lucavenir commented 5 months ago

It looks like so, but also the SDK recently updated, so I thought they've fixed it.

petodavid commented 4 months ago

The latest flutter_facebook_auth: ^7.0.1 fixed this issue by updating the native Facebook iOS SDK to 17.0.2

flakerimi commented 3 months ago

but break android maybe

FAILURE: Build failed with an exception.

darwin-morocho commented 3 months ago

but break android maybe

FAILURE: Build failed with an exception.

  • What went wrong:

Execution failed for task ':flutter_facebook_auth:compileReleaseKotlin'.

Inconsistent JVM-target compatibility detected for tasks 'compileReleaseJavaWithJavac' (1.8) and 'compileReleaseKotlin' (17).

Consider using JVM Toolchain: https://kotl.in/gradle/jvm/toolchain

Learn more about JVM-target validation: https://kotl.in/gradle/jvm/target-validation

  • Try:

Run with --stacktrace option to get the stack trace.

Run with --info or --debug option to get more log output.

Run with --scan to get full insights.

Get more help at https://help.gradle.org.

try using gradle 7 instead of 8