I'm my React Native app, I am trying to prevent user from using the Facebook app (if he has it installed on his device) to login in.
I want the user to use the browser to login via Facebook but it does not work.



// on button click
LoginManager.setLoginBehavior(Platform.OS === 'android' ? 'web_only' : 'browser')
const result = await LoginManager.logInWithPermissions(['public_profile', 'email'])
if (result.isCancelled) {
throw new Error('Facebook login cancelled')
}
if (result && result.grantedPermissions) {
console.log(`Login success with permissions: ${result.grantedPermissions.toString()}`)
}
const data = await AccessToken.getCurrentAccessToken()
return data ? data.accessToken.toString() : void 0
react-native: 0.61.5
react-native-fbsdk: 1.1.1
+1
+1
Check your AppDelegate.m file.
This code:
if ([[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
]) {
return YES;
}
should be above this code:
if ([RCTLinkingManager application:application openURL:url options:options]) {
return YES;
}
Otherwise, RCTLinkingManager will process the link instead of FBSDK
I'm not even able to reproduce this. Even if i install the facebook app, I only get the web version.

I'm not even able to reproduce this. Even if i install the facebook app, I only get the web version.
If you want to reproduce this issue, then login to your facebook app and close it. Then logout facebook credentials from safari browser. Now open your app and click on login with facebook, you will see the issue
@torcoste
Check your AppDelegate.m file.
This code:
if ([[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey] annotation:options[UIApplicationOpenURLOptionsAnnotationKey] ]) { return YES; }should be above this code:
if ([RCTLinkingManager application:application openURL:url options:options]) { return YES; }Otherwise, RCTLinkingManager will process the link instead of FBSDK
What should be the version of FBSDK and react-native-fbsdk? This doesn't seems to working for me despite me giving your above code even in the latest version.
Most helpful comment
Check your AppDelegate.m file.
This code:
should be above this code:
Otherwise, RCTLinkingManager will process the link instead of FBSDK