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
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);
}
}
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:
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
, orKATANA_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
NATIVE_ONLY
).Devices used to test:
v408.1.0.36.103
v408.1.0.36.103
Code samples & details