The identity provider configuration is not found
I am getting this error when I try to authenticate to firebase using FacebookAuthProvider. I am using react-native-fbsdk for facebook authentication integration with react-native. my aim is to login the user ti firebase with the authentication token and record the user data in USERS collection inside firestore.
Below is my code. Any help is appreciated.!
fbAuth(){
LoginManager.logInWithReadPermissions(['public_profile','email','user_photos']).then(
(result)=>{
this.handleCallBack(result),
function(error){
console.log("error in facebook login.");
}
}
);
}
handleCallBack(result){
var _this = this;
if(result.isCancelled){
console.log("facebook login cancelled.");
}else{
AccessToken.getCurrentAccessToken().then(
(data) => {
const token = data.accessToken;
fetch('https://graph.facebook.com/v2.8/me?fields=id,first_name,last_name,gender,birthday&access_token=' + token)
.then((response=>response.json()))
.then((json)=>{
const imageSize = 120;
const facebookID = json.id;
const fbImage = "https://graph.facebook.com/${facebookID}/picture?height=${imageSize}";
})
this.authenticate(data.accessToken)
.then(result =>{
const {uid} = result;
_this.createUser(uid,json,token,fbImage);
})
})
.catch(error=>{
console.log(error);
})
}
}
authenticate = (token) => {
const provider = firebase.auth.FacebookAuthProvider;
const credential = provider.credential(token);
var ret = firebase.auth().signInWithCredential(credential);
return ret;
}
createUser = (uid,userData,token,dp) => {
const defaults = {
uid,
token,
dp,
ageRange: [20, 30]
}
const db = firebase.firestore();
db.settings({timestampsInSnapshots:true});
db.collection('USERS').add({
...userData, ...defaults,
fsTimestamp: firebase.firestore.Timestamp.now()
})
.then(()=>{
console.log("User recorded.");
//this.clearState();
})
.catch((error)=>{console.log(error)});
}
Here are my imports:
import * as firebase from 'firebase';
import 'firebase/firestore';
import {LoginManager,LoginButton,AccessToken,GraphRequest,GraphRequestManager} from 'react-native-fbsdk';