darwin-morocho / flutter-facebook-auth

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

Login screen resets username/password for Android API<28 #269

Closed yoniker closed 2 years ago

yoniker commented 2 years ago

What version are you using?

flutter_facebook_auth: ^4.3.4+2

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

Ubuntu 20.04

What platforms are you seeing the problem on?

Android

pubspec.yaml

name: betabeta
description: A new Flutter project.

publish_to: none

# 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 used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.4.38+0.4.38

environment:
  sdk: '>=2.17.0 <3.0.0'

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.4
  flutter_svg: ^1.0.0
  image_picker: ^0.8.4+4
  speech_bubble: ^0.0.9
  http: ^0.13.4
  url_launcher: ^6.0.20
  shared_preferences: ^2.0.11
  flutter_spinkit: ^5.1.0
  flutter_facebook_auth: ^4.3.4+2
  cached_network_image: ^3.2.0
  flutter_cache_manager: ^3.3.0
  page_indicator: ^0.4.1
  provider: ^6.0.1
  carousel_slider: ^4.0.0
  # flutter_switch: ^0.3.0
  fuzzy: ^0.4.0-nullsafety.0
  trotter: ^2.0.0-dev.1
  tuple: ^2.0.0
  reorderables: ^0.5.0
  font_awesome_flutter: ^10.1.0
  photo_view: ^0.13.0
  hive: ^2.0.5
  tutorial_coach_mark: ^1.2.3
  hive_flutter: ^1.1.0
  tcard:
    git:
      url: https://github.com/yoniker/tcard.git
  path_provider: ^2.0.8
  image: ^3.1.0
  auth_buttons: ^2.0.3
  firebase_core: ^1.10.6
  get: ^4.6.5
  animations: ^2.0.2
  flutter_chat_ui: 1.5.5
  firebase_messaging: ^11.2.4
  flutter_local_notifications: ^9.1.5
  connectivity_plus: ^2.1.0
  firebase_auth: ^3.3.6
  share_plus: ^4.0.10
  video_player: ^2.2.18
  country_code_picker: ^2.0.2
  animated_text_kit: ^4.2.1
  percent_indicator: ^4.2.2
  geolocator: ^8.2.0
  csc_picker: ^0.2.6
  extended_image: ^6.2.1
  pinput: ^2.2.10
  google_fonts: ^2.3.1
  sign_in_with_apple: ^3.3.0
  crypto: ^3.0.1
  app_settings: 4.1.5
  modal_bottom_sheet: ^2.0.1

  # publish_to: 'none'
dependency_overrides:
  photo_view:
    git:
      url: https://github.com/bluefireteam/photo_view
      ref: master

dev_dependencies:
  flutter_test:
    sdk: flutter
  hive_generator: ^1.1.1
  build_runner: ^2.1.7
  flutter_launcher_icons: ^0.9.2

flutter_icons:
  image_path: "icon/icon.png"
  android: true
  ios: true
  #as transparency is not allowed on app store,optional is:
  #remove_alpha_ios: true

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

# The following section is specific to Flutter.
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

  # To add assets to your application, add an assets section, like this:
  # assets:
  #  - images/a_dot_burr.jpeg
  #  - images/a_dot_ham.jpeg

  assets:
    - assets/
    - assets/images/
    - assets/mock_images/
    - assets/
    - assets/celebs_hive.hive
    - assets/celebs.json
    - assets/onboarding/images/
    - assets/onboarding/videos/
  fonts:
    - family: RougeScript
      fonts:
        - asset: assets/fonts/RougeScript-Regular.ttf

    # The major font used in the App.
    - family: Nunito
      fonts:
        - asset: assets/fonts/Nunito/Nunito-ExtraLight.ttf
          weight: 300
        - asset: assets/fonts/Nunito/Nunito-ExtraLightItalic.ttf
          style: italic
          weight: 300
        - asset: assets/fonts/Nunito/Nunito-Light.ttf
          weight: 400
        - asset: assets/fonts/Nunito/Nunito-LightItalic.ttf
          style: italic
          weight: 400
        - asset: assets/fonts/Nunito/Nunito-Regular.ttf
          weight: 500
        - asset: assets/fonts/Nunito/Nunito-Italic.ttf
          style: italic
          weight: 500
        - asset: assets/fonts/Nunito/Nunito-SemiBold.ttf
          weight: 600
        - asset: assets/fonts/Nunito/Nunito-SemiBoldItalic.ttf
          style: italic
          weight: 600
        - asset: assets/fonts/Nunito/Nunito-Bold.ttf
          weight: 700
        - asset: assets/fonts/Nunito/Nunito-BoldItalic.ttf
          style: italic
          weight: 700
        - asset: assets/fonts/Nunito/Nunito-ExtraBold.ttf
          weight: 800
        - asset: assets/fonts/Nunito/Nunito-ExtraBoldItalic.ttf
          style: italic
          weight: 800
        - asset: assets/fonts/Nunito/Nunito-Black.ttf
          weight: 900
        - asset: assets/fonts/Nunito/Nunito-BlackItalic.ttf
          style: italic
          weight: 900

    # Another option for a font used in the App.
    - family: Yantramanav
      fonts:
        - asset: assets/fonts/Yantramanav/Yantramanav-Thin.ttf
          weight: 100
        - asset: assets/fonts/Yantramanav/Yantramanav-Light.ttf
          weight: 300
        - asset: assets/fonts/Yantramanav/Yantramanav-Regular.ttf
          weight: 400
        - asset: assets/fonts/Yantramanav/Yantramanav-Medium.ttf
          weight: 500
        - asset: assets/fonts/Yantramanav/Yantramanav-Bold.ttf
          weight: 700
        - asset: assets/fonts/Yantramanav/Yantramanav-Black.ttf
          weight: 900

    # A minor font used only for some specific widgets such as the TitleTile of the App.
    - family: Montserrat
      fonts:
        - asset: assets/fonts/Montserrat-Bold.ttf
          weight: 700

    - family: LuckiestGuy
      fonts:
        - asset: assets/fonts/LuckiestGuy-Regular.ttf
          weight: 500

    - family: AlfaSlabOne
      fonts:
        - asset: assets/fonts/AlfaSlabOne-Regular.ttf

    - family: Playfair_Display
      fonts:
        - asset: assets/fonts/Playfair_Display/PlayfairDisplay-VariableFont_wght.ttf
          weight: 400
        - asset: assets/fonts/Playfair_Display/static/PlayfairDisplay-Black.ttf
        - asset: assets/fonts/Playfair_Display/static/PlayfairDisplay-Bold.ttf
        - asset: assets/fonts/Playfair_Display/static/PlayfairDisplay-Italic.ttf
          weight: 600

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.io/assets-and-images/#resolution-aware.
  # For details regarding adding assets from package dependencies, see
  # https://flutter.io/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.io/custom-fonts/#from-packages

Describe the Bug

Username/password and email fields are being reset (instead of logging in) indefinetly. See https://youtube.com/shorts/3vN3I610Rrs?feature=share I should note that for the same emulator but with API versions 28,29 and 30, it is working fine.

Expected Behavior

Pass the login screen

To Reproduce

Try to login with API 27 or less (Android)

Relevant log output

07-30 22:43:47.943  4960  4977 D EGL_emulation: eglMakeCurrent: 0xa28070a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:47.943  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902092a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:47.944  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902090c0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.419  4868  4876 E SpellCheckerSession: ignoring processOrEnqueueTask due to unexpected mState=TASK_CLOSE scp.mWhat=TASK_CLOSE
07-30 22:43:48.424  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902092a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.425  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902090c0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.426  4960  4977 D EGL_emulation: eglMakeCurrent: 0xa28070a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.426  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902090c0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.427  4960  4977 D EGL_emulation: eglMakeCurrent: 0xa28070a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.427  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902092a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.429  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902090c0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.562  1629  5192 I WifiService: getConnectionInfo uid=10012
07-30 22:43:48.562  1629  3972 I WifiService: getConnectionInfo uid=10012
07-30 22:43:48.562  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902092a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.563  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902090c0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.564  1629  3972 I WifiService: getDhcpInfo uid=10012
07-30 22:43:48.565  1629  3972 I WifiService: getConnectionInfo uid=10012
07-30 22:43:48.567  1629  3972 I WifiService: getDhcpInfo uid=10012
07-30 22:43:48.572  4960  4977 D EGL_emulation: eglMakeCurrent: 0xa28070a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.573  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902090c0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.575  4960  4977 D EGL_emulation: eglMakeCurrent: 0xa28070a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.576  1777  5071 D EGL_emulation: eglMakeCurrent: 0xa2805ae0: ver 2 0 (tinfo 0xa28033a0)
07-30 22:43:48.577  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902092a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.577  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902090c0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.586  4960  4977 D EGL_emulation: eglMakeCurrent: 0xa28070a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.594  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902090c0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.607  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902092a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.608  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902090c0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.615  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902092a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.615  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902090c0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.617  4960  4977 D EGL_emulation: eglMakeCurrent: 0xa28070a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.617  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902090c0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.623  4960  4977 D EGL_emulation: eglMakeCurrent: 0xa28070a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.625  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902090c0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.637  4868  4868 I chromium: [INFO:CONSOLE(59)] "ErrorUtils caught an error:
07-30 22:43:48.637  4868  4868 I chromium: 
07-30 22:43:48.637  4868  4868 I chromium: Tried to get element with id of "m_login_auto_search_form_contactpoint_hidden_input" but it is not present on the page
07-30 22:43:48.637  4868  4868 I chromium: 
07-30 22:43:48.637  4868  4868 I chromium: Subsequent non-fatal errors won't be logged; see https://fburl.com/debugjs.", source: https://static.xx.fbcdn.net/rsrc.php/v3/yF/r/yit3T_LfGrW.js?_nc_x=Ij3Wp8lg5Kz (59)
07-30 22:43:48.653  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902092a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.654  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902090c0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.666  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902092a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.666  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902090c0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.666  4960  4977 D EGL_emulation: eglMakeCurrent: 0xa28070a0: ver 2 0 (tinfo 0xa2803810)
07-30 22:43:48.666  4960  4977 D EGL_emulation: eglMakeCurrent: 0x902090c0: ver 2 0 (tinfo 0xa2803810)

flutter doctor -v

[✓] Flutter (Channel stable, 3.0.5, on Ubuntu 22.04 LTS 5.15.0-41-generic, locale en_CA.UTF-8)
    • Flutter version 3.0.5 at /home/yoni/software/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (2 weeks ago), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /home/yoni/Android/Sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /home/yoni/software/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • Ubuntu clang version 14.0.0-1ubuntu1
    • cmake version 3.22.1
    • ninja version 1.10.1
    • pkg-config version 0.29.2

[✓] Android Studio (version 2021.2)
    • Android Studio at /home/yoni/software/android-studio
    • Flutter plugin version 69.0.2
    • Dart plugin version 212.5744
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] VS Code
    • VS Code at /snap/code/current
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • Android SDK built for x86 (mobile) • emulator-5556 • android-x86    • Android 8.1.0 (API 27) (emulator)
    • Linux (desktop)                    • linux         • linux-x64      • Ubuntu 22.04 LTS 5.15.0-41-generic
    • Chrome (web)                       • chrome        • web-javascript • Google Chrome 103.0.5060.114

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Info.plist (iOS)

No response

Podfile (iOS)

No response

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.voiladating.Voila">

    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <queries>
        <provider android:authorities="com.facebook.katana.provider.PlatformProvider" />
    </queries>
    <!-- Allow for Http connections `android:usesCleartextTraffic= "true"` -->
    <application
        android:label="Voilà Dating"
        android:icon="@mipmap/ic_launcher">

        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/ic_stat_transparentd" />
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
        <activity
            android:name=".MainActivity"
            android:screenOrientation="portrait"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize"
            android:exported="true">
            <!-- This keeps the window background of the activity showing
                 until Flutter renders its first frame. It can be removed if
                 there is no splash screen (such as the default splash screen
                 defined in @style/LaunchTheme). -->
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <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"/>

        <activity android:name="com.facebook.FacebookActivity"
            android:configChanges=
                "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name" />
        <activity
            android:name="com.facebook.CustomTabActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="@string/fb_login_protocol_scheme" />
            </intent-filter>
        </activity>

    </application>

</manifest>

MainActivity.java

package com.voiladating.Voila;

import android.os.Bundle;
import io.flutter.embedding.android.FlutterActivity;

public class MainActivity extends FlutterActivity {
}

MainActivity.kt

package com.voiladating.Voila

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}

index.html

No response

Info.plist (macOS)

No response

darwin-morocho commented 2 years ago

@yoniker try to upgrade to the last version of this plugin flutter_facebook_auth maybe is a bug in the facebook native sdk since flutter_facebook_auth: 4.4.0 this plugin uses the last version of the facebook sdk

yoniker commented 2 years ago

@darwin-morocho I tried flutter_facebook_auth: ^4.4.0+1 (including clearing the cache and flutter clean) and same issue.

darwin-morocho commented 2 years ago

@yoniker

you should remove

        <activity android:name="com.facebook.FacebookActivity"
            android:configChanges=
                "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name" />
        <activity
            android:name="com.facebook.CustomTabActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="@string/fb_login_protocol_scheme" />
            </intent-filter>
        </activity>

from your AndroidManifest.

Also. Why you have 2 MainActivity classes?

darwin-morocho commented 2 years ago

@yoniker this seem to be a bug of the native facebook sdk so you should open the issue here https://github.com/facebook/facebook-android-sdk

yoniker commented 2 years ago

I've removed it as suggested, still the same. I'll submit a bug at that repo as suggested. Huh, I just found out that after updating Google play store, and updating chrome, the problem goes away. Weird.

darwin-morocho commented 2 years ago

@yoniker if the problem was solved close the issue

yoniker commented 2 years ago

Sure. In your opinion should I consider it as solved? i.e. I'm not sure how many users updated (or didn't update) chrome. Either way, almost for sure it's not an issue with this repo.

darwin-morocho commented 2 years ago

Because the issue is not related with this plugin it must be closed