facebook-android-sdk icon indicating copy to clipboard operation
facebook-android-sdk copied to clipboard

Facebook Login opening Webview instead of Native App

Open ibrahim-musa opened this issue 1 year ago • 1 comments

Checklist before submitting a bug report

Java version

1.8

Android version

API 31

Android SDK version

15.0.0

Installation platform & version

Gradle

Package

Login

Goals

I want to use a Facebook Login function in my app with these permissions:

"ads_management", "pages_manage_ads", "leads_retrieval", "pages_manage_metadata", "pages_read_engagement"

The issue is even when user had installed native Facebook app in their devices and already logged in, when calling Facebook login function it sometime open a webview instead of native Facebook app. This happen not every time but only some time such as when user switch their Facebook profile to a Page Profile instead of a User Profile (see steps below for reproduce the issue). But the issue will usually remain even after user switching back to user profile instead of a page profile.

Expected results

It should open a Facebook native app if device had already install Facebook native app and even if device don't have it, it should at least open a chrome custom tab Facebook web and not webview since webview is no longer supported and causing the user not able to log in at all.

Actual results

It open a Facebook webview instead of Facebook native app although the I've set the login behaviour to NATIVE_WITH_FALLBACK, NATIVE_ONLY, or KATANA_ONLY.

But I notice it works when I set the login behaviour to WEB_ONLY, it correctly open a chrome custom tab in my app and not a webview. But what I need is login using native app not web app.

Steps to reproduce

  • Make sure you're logged in in Facebook native app with profile that manage at least 1 page.
  • Go to Facebook Menu Profile, switch to a Page instead of user profile (click on the 🔽 button beside the account name to switch to a Page profile)
  • Go to your app and do action that call Facebook Login function (as code sample shown above)
  • It will trigger opening a webview instead of Facebook native app although Facebook app is actually installed in your device and you've logged in (even if you set login behaviour to NATIVE_ONLY).
  • Even after you switch back your Facebook app to a user profile instead of page, the issue will still remain until you manually log out your account in Facebook app and then re-login. This is so annoying for user to always need to logout and re-login everytime they switch to use Facebook page. (see image below for sample screenshot)

Devices used to test:

  • Samsung S22 Ultra (Android 13) with Facebook app v408.1.0.36.103
  • Samsung Note 10 (Android 12) with Facebook app v408.1.0.36.103

Screenshot_20230403_193136_Chrome Screenshot_20230403_193301_Facebook Screenshot_20230403_193412_Facebook

Code samples & details

public void logInWithPermissions(final Promise promise) {
    List<String> permissions = Arrays.asList("ads_management", "pages_manage_ads", "leads_retrieval", "pages_manage_metadata", "pages_read_engagement");
    final LoginManager loginManager = LoginManager.getInstance();
    loginManager.registerCallback(getCallbackManager(), new LoginManagerCallback(promise));
    loginManager.setLoginBehavior(LoginBehavior.NATIVE_ONLY);
    Activity activity = getCurrentActivity();
    if (activity != null) {
        loginManager.logIn(activity, permissions);
    }
}

ibrahim-musa avatar Apr 03 '23 12:04 ibrahim-musa

Same issue. News?

manuelcoders avatar Jul 11 '23 20:07 manuelcoders