I am running this issue with ios only while android is working as expected
[Error: Unsuccessful debug_token response from Facebook: {“error”:{“message”:“(#100) The App_id in the input_token did not match the Viewing App”,“type”:“OAuthException”,“code”:100,“fbtrace_id”:“AfYgW7S4Q0iUArRGRQT6K0b”}}]
first android was not logging in then suddenly everything changed and got android logging and saving user to firebase while ios is not I tried everything with no hope
It seems Facebook part is running well as the token is being generated and returned but, there is issue in firebase itself
import React, {useEffect} from 'react';
import {View, Text, StyleSheet, Button, Alert} from 'react-native';
import firebase from 'firebase';
import * as Facebook from 'expo-facebook';
const HomeScreen = () => {
useEffect(() => {
checkUser();
}, [])
const checkUser = () => {
firebase.auth().onAuthStateChanged(user => {
if (user !== null) {
console.log('user')
}
})
}
FBlogIn = async () => {
await Facebook.initializeAsync('appId');
try {
const {
type,
token,
expires,
permissions,
declinedPermissions
} = await Facebook.logInWithReadPermissionsAsync({
permissions: ["email","public_profile"]
});
if (type === "success") {
// Get the user's name using Facebook's Graph API
const response = await fetch(
`https://graph.facebook.com/me?access_token=${token}`
);
console.log(token);
Alert.alert("Logged in!", `Hi ${(await response.json()).name}!`);
const credentials = await firebase.auth.FacebookAuthProvider.credential(token);
await firebase.auth().signInWithCredential(credentials)
.catch(error => {
console.log(error)
});
console.log('Done');
} else {
alert(`Facebook Login Error: Cancelled`);
}
} catch ({ message }) {
alert(`Facebook Login Error: ${message}`);
// or do your own login
}
};
return (
<View style = {styles.container}>
<Text style = {styles.textStyle}>Welcome Home</Text>
<Button
full
rounded
primary
title = 'Login with Facebook'
onPress = {FBlogIn}
/>
</View>
);
}
const styles = StyleSheet.create({
container : {
flex : 1,
alignItems : 'center',
justifyContent : 'center',
backgroundColor : '#e8e8e8'
},
textStyle : {
color : 'blue',
fontSize : 22,
}
})
export default HomeScreen;
Expo CLI 3.21.9 environment info:
System:
OS: Windows 10 10.0.18363
Binaries:
Node: 12.18.0 - C:\Program Files\nodejs\node.EXE
npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 4.0.0.0 AI-193.6911.18.40.6514223
npmPackages:
expo: ~37.0.3 => 37.0.12
react: ~16.9.0 => 16.9.0
react-dom: ~16.9.0 => 16.9.0
react-native: https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz => 0.61.4
react-native-web: ~0.11.7 => 0.11.7
react-navigation: ^4.3.9 => 4.3.9