darwin-morocho / flutter-facebook-auth

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

Too many calls to Facebook API #387

Closed Johnsones closed 1 month ago

Johnsones commented 2 months ago

What version are you using?

flutter_facebook_auth:5.0.11

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

iOS all versions, Android all version

What platforms are you seeing the problem on?

Android, iOS

pubspec.yaml

environment:
  sdk: ">=2.15.0 <3.0.0"

dependencies:
  flutter_facebook_auth: 5.0.11

Describe the Bug

I receive a lot of additional calls to the Facebook API besides the Login call. The user and user permission calls are only a fraction of the total API calls. Calls to Facebook API

The way login is implemented in our app is as follows:

  1. Call to get Facebook Access token using the flutter_facebook_auth package by first letting the user sign in (FacebookAuth.i.login()). After a successful login I retrieve the Access Token.
  2. The Access Token is sent to our own backend. Here the Token is used in a get API call to Facebooks 'me' endpoint to retrieve the email of the user.

My first assumption was that it had to do with autologging, but even after disabling autologging the issue still persists. I would like to know if any other parts of the package make hidden calls or if some autologging is still present.

Expected Behavior

I expect to only see Graph calls to get:User and get:User/permissions being made.

To Reproduce

final LoginResult result = await FacebookAuth.i.login();

Relevant log output

No response

flutter doctor -v

[√] Flutter (Channel stable, 3.10.4, on Microsoft Windows [Version 10.0.14393], locale nl-NL)
    • Flutter version 3.10.4 on channel stable at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 682aa387cf (8 months ago), 2023-06-05 18:04:56 -0500
    • Engine revision 2a3401c9bb
    • Dart version 3.0.3
    • DevTools version 2.23.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:\Android
    • Platform android-33, build-tools 34.0.0
    • ANDROID_HOME = C:\Android
    • ANDROID_SDK_ROOT = C:\Android\Sdk
    • Java binary at: C:\Program Files\Java\jdk-18.0.1.1\bin\java
    • Java version Java(TM) SE Runtime Environment (build 18.0.1.1+2-6)
    • All Android licenses accepted.

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

[!] Visual Studio - develop for Windows (Visual Studio Professional 2022 17.6.10)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Professional
    • Visual Studio Professional 2022 version 17.6.34302.98
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development
      with C++" workload, and include these components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK

[!] Android Studio (version 2022.3)
    • 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
    X Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[!] Android Studio (version 2023.1)
    • Android Studio at C:\Program Files\Android\Android Studio1
    • 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
    X Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[√] VS Code, 64-bit edition (version 1.85.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.82.0

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

Info.plist (iOS)

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>fb{your-app-id}</string>
    </array>
  </dict>
</array>
<key>FacebookAppID</key>
<string>{your-app-id}</string>
<key>FacebookClientToken</key>
<string>CLIENT-TOKEN</string>
<key>FacebookDisplayName</key>
<string>{your-app-name}</string>
<key>LSApplicationQueriesSchemes</key>
<array>
  <string>fbapi</string>
  <string>fb-messenger-share-api</string>
</array>
<key>FacebookAutoLogAppEventsEnabled</key>
<false/>

Podfile (iOS)

No response

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="app.meedu.flutter_facebook_auth_example">
    <uses-permission android:name="android.permission.INTERNET" />
    <application
       android:name="${applicationName}"
       android:icon="@mipmap/ic_launcher"
       android:label="facebook auth">

       <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"/>
       <meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled"
           android:value="false"/>

        <activity
           android:name=".MainActivity"
           android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
           android:hardwareAccelerated="true"
           android:launchMode="singleTop"
           android:theme="@style/LaunchTheme"
           android:exported="true"
           android:windowSoftInputMode="adjustResize">
           <meta-data
               android:name="io.flutter.embedding.android.NormalTheme"
               android:resource="@style/NormalTheme" />
           <meta-data
               android:name="io.flutter.embedding.android.SplashScreenDrawable"
               android:resource="@drawable/launch_background" />
           <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.intent.category.LAUNCHER" />
           </intent-filter>
       </activity>
       <meta-data
           android:name="flutterEmbedding"
           android:value="2" />
    </application>
</manifest>

MainActivity.java

No response

MainActivity.kt

No response

index.html

No response

Info.plist (macOS)

No response

darwin-morocho commented 2 months ago

What version are you using?

flutter_facebook_auth:5.0.11

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

iOS all versions, Android all version

What platforms are you seeing the problem on?

Android, iOS

pubspec.yaml

environment:
  sdk: ">=2.15.0 <3.0.0"

dependencies:
  flutter_facebook_auth: 5.0.11

Describe the Bug

I receive a lot of additional calls to the Facebook API besides the Login call. The user and user permission calls are only a fraction of the total API calls. Calls to Facebook API

The way login is implemented in our app is as follows:

  1. Call to get Facebook Access token using the flutter_facebook_auth package by first letting the user sign in (FacebookAuth.i.login()). After a successful login I retrieve the Access Token.
  2. The Access Token is sent to our own backend. Here the Token is used in a get API call to Facebooks 'me' endpoint to retrieve the email of the user.

My first assumption was that it had to do with autologging, but even after disabling autologging the issue still persists. I would like to know if any other parts of the package make hidden calls or if some autologging is still present.

Expected Behavior

I expect to only see Graph calls to get:User and get:User/permissions being made.

To Reproduce

final LoginResult result = await FacebookAuth.i.login();

Relevant log output

No response

flutter doctor -v

[√] Flutter (Channel stable, 3.10.4, on Microsoft Windows [Version 10.0.14393], locale nl-NL)
    • Flutter version 3.10.4 on channel stable at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 682aa387cf (8 months ago), 2023-06-05 18:04:56 -0500
    • Engine revision 2a3401c9bb
    • Dart version 3.0.3
    • DevTools version 2.23.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:\Android
    • Platform android-33, build-tools 34.0.0
    • ANDROID_HOME = C:\Android
    • ANDROID_SDK_ROOT = C:\Android\Sdk
    • Java binary at: C:\Program Files\Java\jdk-18.0.1.1\bin\java
    • Java version Java(TM) SE Runtime Environment (build 18.0.1.1+2-6)
    • All Android licenses accepted.

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

[!] Visual Studio - develop for Windows (Visual Studio Professional 2022 17.6.10)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Professional
    • Visual Studio Professional 2022 version 17.6.34302.98
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development
      with C++" workload, and include these components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK

[!] Android Studio (version 2022.3)
    • 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
    X Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[!] Android Studio (version 2023.1)
    • Android Studio at C:\Program Files\Android\Android Studio1
    • 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
    X Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[√] VS Code, 64-bit edition (version 1.85.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.82.0

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

Info.plist (iOS)

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>fb{your-app-id}</string>
    </array>
  </dict>
</array>
<key>FacebookAppID</key>
<string>{your-app-id}</string>
<key>FacebookClientToken</key>
<string>CLIENT-TOKEN</string>
<key>FacebookDisplayName</key>
<string>{your-app-name}</string>
<key>LSApplicationQueriesSchemes</key>
<array>
  <string>fbapi</string>
  <string>fb-messenger-share-api</string>
</array>
<key>FacebookAutoLogAppEventsEnabled</key>
<false/>

Podfile (iOS)

No response

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="app.meedu.flutter_facebook_auth_example">
    <uses-permission android:name="android.permission.INTERNET" />
    <application
       android:name="${applicationName}"
       android:icon="@mipmap/ic_launcher"
       android:label="facebook auth">

       <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"/>
       <meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled"
           android:value="false"/>

        <activity
           android:name=".MainActivity"
           android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
           android:hardwareAccelerated="true"
           android:launchMode="singleTop"
           android:theme="@style/LaunchTheme"
           android:exported="true"
           android:windowSoftInputMode="adjustResize">
           <meta-data
               android:name="io.flutter.embedding.android.NormalTheme"
               android:resource="@style/NormalTheme" />
           <meta-data
               android:name="io.flutter.embedding.android.SplashScreenDrawable"
               android:resource="@drawable/launch_background" />
           <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.intent.category.LAUNCHER" />
           </intent-filter>
       </activity>
       <meta-data
           android:name="flutterEmbedding"
           android:value="2" />
    </application>
</manifest>

MainActivity.java

No response

MainActivity.kt

No response

index.html

No response

Info.plist (macOS)

No response

Please try with the last version of this plugin

Johnsones commented 1 month ago

I tried with the last version 6.0.4, but there are still too many calls. image

darwin-morocho commented 1 month ago

this plugin only wraps the native Facebook sdk try checking in the native repos

https://github.com/facebook/facebook-android-sdk

https://github.com/facebook/facebook-ios-sdk

imeckr commented 1 week ago

@Johnsones I am also facing the same issue, were you able to find a fix for this ?