Reputation: 4003
I'm using firebase facebook for my app. I just want user's public profile so that I can create user in my database. I do not want firebase full authentication just the profile detail but I am getting the following error.
Here is some code
const firebaseConfig = {
apiKey: FIREBASE_KEY,
authDomain: FIREBASE_AUTH_DOMAIN,
databaseURL: FIREBASE_DATABASE_URL,
projectId: FIREBASE_PROJECT_ID,
storageBucket: FIREBASE_STORAGE_BUCKET
}
export const Firebase = firebase.initializeApp(firebaseConfig);
async loginWithFacebook(navigate){
const { type, token} = await Expo.Facebook.logInWithReadPermissionsAsync(FACEBOOK_APP_ID, {
permissions: ['public_profile'],
});
if (type == 'success') {
const provider = new Firebase.auth.FacebookAuthProvider();
const credential = provider.credential(token);
Firebase.auth().signInWithCredential(credential)
.then((user) => {})
.catch((error) => {
});
}
}
I'm very new in react native please let me know what I'm doing wrong here.
Upvotes: 1
Views: 1581
Reputation: 30818
Change your code to the following:
const credential = Firebase.auth.FacebookAuthProvider.credential(token);
Firebase.auth().signInWithCredential(credential)
credential
is a static method on firebase.auth.FacebookAuthProvider
.
Upvotes: 1