thebergamo / react-native-fbsdk-next

MIT License
633 stars 165 forks source link

App switches automatically to limited login when updated to v13 #520

Closed beliven-davide-lorigliola closed 3 days ago

beliven-davide-lorigliola commented 1 week ago

I'm using react-native-fbsdk-sdk for facebook login in my application. I've update react-native-fbsdk-sdk : ^13.0.0

Now my Facebook SSO login opens by default to limited.facebook.com domain.

Here's my code:

import {LoginManager, AccessToken} from 'react-native-fbsdk-next';
import auth from '@react-native-firebase/auth';
import {showErrorIfAllowed} from './functions';

export async function onFacebookButtonPress(onError) {
  try {
    // Attempt login with permissions
    const result = await LoginManager.logInWithPermissions([
      'public_profile',
      'email',
    ]);

    if (result.isCancelled) {
      throw {
        code: '-5',
        name: 'Error',
        message: 'User cancelled the login process',
      };
    }

    // Once signed in, get the users AccesToken
    const data = await AccessToken.getCurrentAccessToken();

    if (!data) {
      throw {
        code: '0',
        name: 'Error',
        message: 'Something went wrong obtaining access token',
      };
    }

    // Create a Firebase credential with the AccessToken
    const facebookCredential = auth.FacebookAuthProvider.credential(
      data.accessToken,
    );

    // Sign-in the user with the credential
    return auth().signInWithCredential(facebookCredential);
  } catch (e) {
    showErrorIfAllowed(e, onError);
  }
}
brainbicycle commented 1 week ago

this is an upstream change with version 17 of the Facebook iOS SDK: https://github.com/facebook/facebook-ios-sdk/issues/2375 and it sounds like it is a deliberate behavior change by Facebook, if you do not have tracking permissions you automatically get opted into limited login. So you have a few options:

either way I don't think there is anything that can be done on this library.