React Native Project to Integrate Facebook Phone Number Authentication in Android & IOS
<plist version="1.0">
<dict>
...
<key>FacebookAppID</key>
<string>{your-app-id}</string>
<key>AccountKitClientToken</key>
<string>{your-account-kit-client-token}</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>ak{your-app-id}</string>
</array>
</dict>
</array>
...
</dict>
</plist>
import React, { Component } from 'react';
import { View, StyleSheet } from 'react-native';
import RNAccountKit from 'react-native-facebook-account-kit';
class Home extends Component {
constructor(props){
super(props);
}
componentDidMount(){
// Initiate authentication
RNAccountKit.loginWithPhone()
.then((token) => {
if (!token) {
console.log('Login cancelled')
} else {
//authentication success
console.log(`Logged with phone. Token: ${token}`);
this.props.navigation.navigate('Home');
}
})
}
render() {
return (
<View style={styles.container}>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white',
}
});
export default Home;