darwin-morocho / flutter-facebook-auth

A flutter plugin to add login with facebook in your flutter app
191 stars 124 forks source link

Can't Login with Flutter on android devices? #399

Open emadyounan opened 2 weeks ago

emadyounan commented 2 weeks ago

What version are you using?

flutter_facebook_auth: ^6.2.0

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

windows 10

What platforms are you seeing the problem on?

Android

pubspec.yaml

name: msrofaty
description: "A new Flutter project."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.4+9

environment:
  sdk: ">=3.3.0 <4.0.0"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  android_alarm_manager_plus: ^4.0.1
  awesome_dialog: ^3.2.0
  calendar_date_picker2: ^0.5.5
  cloud_firestore: ^4.15.9
  cupertino_icons: ^1.0.6
  currency_picker: ^2.0.21
  device_preview: ^1.1.0
  dots_indicator: ^3.0.0
  excel: ^4.0.3
  file_selector: ^1.0.3
  firebase_auth: ^4.17.9
  firebase_core: ^2.27.1
  firebase_messaging: ^14.7.20
  firebase_storage: ^11.6.10
  flutter:
    sdk: flutter
  flutter_app_badger: ^1.5.0
  flutter_date_pickers: ^0.4.2
  flutter_facebook_auth: ^6.2.0
  flutter_local_notifications: ^17.0.0
  flutter_timezone: ^1.0.8
  font_awesome_flutter: ^10.7.0
  get: ^4.6.6
  get_storage: ^2.1.1
  google_mobile_ads: ^5.0.0
  google_sign_in: ^6.2.1
  http: ^1.2.1
  image_picker: ^1.0.7
  in_app_purchase: ^3.1.13
  intl: ^0.18.1
  month_picker_dialog: ^2.11.2
  path: ^1.9.0
  path_provider: ^2.1.2
  pie_chart: ^5.4.0
  share_plus: ^8.0.2
  shared_preferences: ^2.2.2
  sqflite: ^2.3.1
  timezone: ^0.9.2
  twitter_login: ^4.4.2
  url_launcher: ^6.2.5
  uuid: ^4.3.3

dev_dependencies:
  flutter_lints: ^3.0.0
  flutter_test:
    sdk: flutter

# 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:
  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true
  assets:
    - assets/images/
    - assets/Thumbs/
  # To add assets to your application, add an assets section, like this:
  # assets:
  #   - images/a_dot_burr.jpeg
  #   - images/a_dot_ham.jpeg
  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware
  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages
  # To add custom fonts to your application, 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 from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

Describe the Bug

My login function is working fine with my personal Facebook account, but when I try to log in with a different Facebook account I get an error in the attached Image How do solve this,

that's my standard access at Facebook Developer account vertify

Expected Behavior

Login to user Facebook data and get the email and user name infomation

To Reproduce

that's my code

final LoginResult loginResult = await FacebookAuth.instance.login();
      if (loginResult.status == LoginStatus.success) {
        final OAuthCredential facebookAuthCredential =
            FacebookAuthProvider.credential(loginResult.accessToken!.token);

        // Once signed in, return the UserCredential
        UserCredential userauth =
            await _auth.signInWithCredential(facebookAuthCredential);
}

my manifest.xml file

    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
    <meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token"/>

android/app/build.gradle implementation 'com.facebook.android:facebook-android-sdk:latest.release'

I got this issue while login thanks.

WhatsApp Image 2024-04-21 at 14 38 26_e929c008

Relevant log output

No response

flutter doctor -v

[√] Flutter (Channel stable, 3.19.5, on Microsoft Windows [Version 10.0.19045.4291], locale en-US)
    • Flutter version 3.19.5 on channel stable at C:\Users\emady\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 300451adae (3 weeks ago), 2024-03-27 21:54:07 -0500
    • Engine revision e76c956498
    • Dart version 3.3.3
    • DevTools version 2.31.1

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\emady\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.3)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.8.34330.188
    • Windows 10 SDK version 10.0.18362.0

[√] Android Studio (version 2023.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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.7+0-b2043.56-10550314)

[√] VS Code (version 1.88.1)
    • VS Code at C:\Users\emady\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.86.0

[√] Connected device (5 available)
    • RMX2061 (mobile)             • 56505ce5      • android-arm64  • Android 11 (API 30)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 14 (API 34) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.19045.4291]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 123.0.6312.124
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 124.0.2478.51

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

• No issues found!

Info.plist (iOS)

No response

Podfile (iOS)

No response

AndroidManifest.xml

No response

MainActivity.java

No response

MainActivity.kt

No response

index.html

No response

Info.plist (macOS)

No response

wilfredonoyola commented 1 week ago

I have the same problem!!!! Hey @darwin-morocho Do you have some time for fix this problem?

Thanks!

darwinmorocho-deuna commented 1 week ago

I have the same problem!!!! Hey @darwin-morocho Do you have some time for fix this problem?

Thanks!

This is not an issue of this plugin. I think is a problem with your meta configuration

darwinmorocho-deuna commented 1 week ago

@emadyounan you don't need this implementation 'com.facebook.android:facebook-android-sdk:latest.release' due to this plugin already add that dependency

MarvinQuevedo commented 1 week ago

I have the same problem!!!! Hey @darwin-morocho Do you have some time for fix this problem? Thanks!

This is not an issue of this plugin. I think is a problem with your meta configuration

Do you know if exist some migration guide to can configure It and void this issue?

emadyounan commented 1 week ago

I Found the Solution It was not on My Code It was needed to verify the business account, I don't know Why Meta Made that as only who has Bussiness account who can use that