React Native + Firebase : How to use Facebook authentication
I started building an app with React Native and am in the process of implementing a firebase backend. I added the standard login with firebase, but now having issue when implementing the facebook authentication. I'm unable to access the FacebookAuthProvider mentionned in the documentation. https://firebase.google.com/docs/reference/js/firebase.auth.FacebookAuthProvider They give two contradictory examples, and neither seems to work. In the first, it is instantiated: var provider = new firebase.auth.FacebookAuthProvider(); When I try to invoke this, I get an error. 12-23 19:14:07.388 3082 3517 E ReactNativeJS: undefined is not a constructor (evaluating 'new _Firebase2.default.auth.FacebookAuthProvider()') And a few lines below they give the following example: var cred = firebase.auth.FacebookAuthProvider.credential(...) Where it's being accessed as a static object and not a constructor. This also does not seem to work. I have difficulty understanding how the Firebase API actually works given those two examples, and I still don't have a functional FB authentication for my app. Any help is much appreciated!
This isn’t clearly explained in the Firebase API but it seems that there’s a clear distinction between the API provided by an instantiated FirebaseApp and the API provided by the Firebase module.
My mistake was that I was trying to access the FacebookAuthProvider through my FirebaseApp instead of the actual Firebase module. I now changed the reference and everything seems to be working.
- Database Administration Tutorials
- Programming Tutorials & IT News
- Linux & DevOps World
- Entertainment & General News
- Games & eSport