flutter-facebook-auth icon indicating copy to clipboard operation
flutter-facebook-auth copied to clipboard

Facebook business login issues : it looks like app isn't available

Open DEVELOPBYSHUBH opened this issue 1 year ago • 6 comments

What version are you using?

7.1.1

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

macOS 14.4

What platforms are you seeing the problem on?

Android, iOS

pubspec.yaml

flutter_facebook_auth: ^7.1.1

  app_tracking_transparency: ^2.0.6

Describe the Bug

When I am doing a Facebook business login after login my Facebook account I get that it looks like the app isn't available. Simulator Screenshot - iPhone 15 Pro Max - 2024-09-11 at 13 15 15

Expected Behavior

It should not come this

To Reproduce

Future<ApiResult<String>> getFacebookUserToken() async { print("facebook login"); try { final LoginResult loginResult = await FacebookAuth.instance.login(permissions: [ SocialMediaConstants.permissionPagesShowList, SocialMediaConstants.permissionManageMetadata, SocialMediaConstants.permissionManagePosts, SocialMediaConstants.permissionManageReadEngagement, SocialMediaConstants.permissionPageMessaging, SocialMediaConstants.permissionPageManageAds, SocialMediaConstants.permissionBusinessManagement ]); print("loginResult , ${loginResult.message}");

  if (loginResult.status == LoginStatus.success &&
      // _isPostPermissionGrantedForFacebook(loginResult) &&
      loginResult.accessToken?.tokenString != null) {
    log.e("Result ${loginResult.accessToken?.toJson()}");
    log.d("Token ${loginResult.accessToken?.tokenString}");
    return ApiResult.success(loginResult.accessToken!.tokenString);
  } else if (loginResult.status == LoginStatus.success
      // &&  _isPostPermissionGrantedForFacebook(loginResult) == false
      ) {
    return const ApiResult.failure(NetworkExceptions.defaultError(
        'Please provide all requested post permission'));
  }
  return ApiResult.failure(NetworkExceptions.defaultError(
      loginResult.message ?? 'Something went wrong'));
} on Exception catch (e) {
  return ApiResult.failure(NetworkExceptions.getDioException(e));
}

}

Relevant log output

No response

flutter doctor -v

flutter doctor -v
[✓] Flutter (Channel stable, 3.22.2, on macOS 14.6.1 23G93 darwin-arm64, locale
    en-IN)
    • Flutter version 3.22.2 on channel stable at
      /Users/nileshchaubey/Documents/allSoftware/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (3 months ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/nileshchaubey/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/nileshchaubey/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • 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 2024.1)
    • 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.11+0-17.0.11b1207.24-11852314)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • 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

[✓] VS Code (version 1.93.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.96.0

[✓] VS Code (version 1.82.3)
    • VS Code at /Users/nileshchaubey/Library/Mobile
      Documents/com~apple~CloudDocs/Desktop/Visual Studio Code.app/Contents
    • Flutter extension version 3.96.0

[✓] Connected device (4 available)
    • iPhone 15 Pro Max (mobile)      • 959246C5-D322-4554-B9C7-AD589A9C433A • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator)
    • macOS (desktop)                 • macos                                • darwin-arm64   • macOS
      14.6.1 23G93 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS
      14.6.1 23G93 darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google
      Chrome 128.0.6613.120

[✓] 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

DEVELOPBYSHUBH avatar Sep 11 '24 07:09 DEVELOPBYSHUBH

Facing the same issue

Psquare-0 avatar Sep 15 '24 10:09 Psquare-0

Any fix ? got the same problem :(

yoboitel avatar Dec 19 '24 14:12 yoboitel

Any fix ? got the same problem :(

@yoboitel that is not an issue of this plugin. Due to this plugin only wraps the Facebook Login SDK.

You must go to the official Facebook Login SDK repo an open an issue there.

darwin-morocho avatar Dec 19 '24 14:12 darwin-morocho

Also limited login does not allow use

SocialMediaConstants.permissionPagesShowList,
SocialMediaConstants.permissionManageMetadata,
SocialMediaConstants.permissionManagePosts,
SocialMediaConstants.permissionManageReadEngagement,
SocialMediaConstants.permissionPageMessaging,
SocialMediaConstants.permissionPageManageAds,
SocialMediaConstants.permissionBusinessManagement

If you need that scopes you must use the normal login flow and for that you app must have the appTracking transparency permission granted befor run the facebook login

darwin-morocho avatar Dec 19 '24 14:12 darwin-morocho

Also limited login does not allow use

SocialMediaConstants.permissionPagesShowList,
SocialMediaConstants.permissionManageMetadata,
SocialMediaConstants.permissionManagePosts,
SocialMediaConstants.permissionManageReadEngagement,
SocialMediaConstants.permissionPageMessaging,
SocialMediaConstants.permissionPageManageAds,
SocialMediaConstants.permissionBusinessManagement

If you need that scopes you must use the normal login flow and for that you app must have the appTracking transparency permission granted befor run the facebook login

Thank you, for now I'm using only email and public_profile to test, but event with these i cannot make it working.

Here is my code, is there something wrong ?

onTap: () async { // Check if the user has authorized the app to use the tracking data (only for iOS) TrackingStatus? status; if (Platform.isIOS) { await AppTrackingTransparency .requestTrackingAuthorization(); status = await AppTrackingTransparency .trackingAuthorizationStatus; }

                            // Trigger the sign-in flow
                            final rawNonce = generateNonce();
                            final nonce = sha256ofString(rawNonce);
                            final result =
                                await FacebookAuth.instance.login(
                              loginTracking:
                                  status == TrackingStatus.authorized
                                      ? LoginTracking.enabled
                                      : LoginTracking.limited,
                              loginBehavior:
                                  LoginBehavior.nativeWithFallback,
                              permissions: [
                                'email',
                                if (status == TrackingStatus.authorized)
                                  'public_profile'
                              ],
                              nonce: nonce,
                            );
                            if (result.status == LoginStatus.success &&
                                result.accessToken != null) {
                              print(
                                  'AuthenticationFacebook iOS - Access Token: ${result.accessToken}');

                              return null;
                            }

                            print(
                                'AuthenticationFacebook iOS - Error: ${result.message}');

                            return null;
                          },

yoboitel avatar Dec 19 '24 14:12 yoboitel

I have the same issue 🥲

yelkamel avatar Mar 15 '25 10:03 yelkamel

Also limited login does not allow use

SocialMediaConstants.permissionPagesShowList,
SocialMediaConstants.permissionManageMetadata,
SocialMediaConstants.permissionManagePosts,
SocialMediaConstants.permissionManageReadEngagement,
SocialMediaConstants.permissionPageMessaging,
SocialMediaConstants.permissionPageManageAds,
SocialMediaConstants.permissionBusinessManagement

If you need that scopes you must use the normal login flow and for that you app must have the appTracking transparency permission granted befor run the facebook login

Thank you, for now I'm using only email and public_profile to test, but event with these i cannot make it working.

Here is my code, is there something wrong ?

onTap: () async { // Check if the user has authorized the app to use the tracking data (only for iOS) TrackingStatus? status; if (Platform.isIOS) { await AppTrackingTransparency .requestTrackingAuthorization(); status = await AppTrackingTransparency .trackingAuthorizationStatus; }

                            // Trigger the sign-in flow
                            final rawNonce = generateNonce();
                            final nonce = sha256ofString(rawNonce);
                            final result =
                                await FacebookAuth.instance.login(
                              loginTracking:
                                  status == TrackingStatus.authorized
                                      ? LoginTracking.enabled
                                      : LoginTracking.limited,
                              loginBehavior:
                                  LoginBehavior.nativeWithFallback,
                              permissions: [
                                'email',
                                if (status == TrackingStatus.authorized)
                                  'public_profile'
                              ],
                              nonce: nonce,
                            );
                            if (result.status == LoginStatus.success &&
                                result.accessToken != null) {
                              print(
                                  'AuthenticationFacebook iOS - Access Token: ${result.accessToken}');

                              return null;
                            }

                            print(
                                'AuthenticationFacebook iOS - Error: ${result.message}');

                            return null;
                          },

bro have you solved this

thanggggg1 avatar Jun 17 '25 03:06 thanggggg1

I have the same isuess... any new?

PhuCG avatar Oct 06 '25 03:10 PhuCG