I am trying to authenticate with facebook login in react native and getting this error below on all IOS Device using the module react-native-fbsdk-next
Firebase: Bad access token: {"code":190,"message":"Bad signature"} (auth/invalid-credential)
I tried different facebook accounts and iOS devices, and nothing seems to work.
The App ID and App Secret for facebook matchs in Firebase, and it is working on android device but not iOS devices
Here is the code snippet below
import { AccessToken, AuthenticationToken, LoginManager} from 'react-native-fbsdk-next';
import { getAuth, signInWithCredential,FacebookAuthProvider, } from "firebase/auth";
try {
const result = await LoginManager.logInWithPermissions(['public_profile', 'email'], 'limited', 'my_nonce');
if (result.isCancelled) {
console.log('User cancelled the login process');
return;
}
const data = await AuthenticationToken.getAuthenticationTokenIOS();
if (!data) {
throw new Error('Something went wrong obtaining the Facebook access token');
}
console.log('Facebook Access Token:', data.authenticationToken);
const facebookCredential = FacebookAuthProvider.credential(data.accessToken);
await signInWithCredential(auth, facebookCredential);
} catch (error) {
console.error('Facebook login error:', error.message);
// Handle other errors if necessary
}