Does Firebase.auth.FacebookAuthProvider not exist for Firebase React Native?

1,358 views
Skip to first unread message

Joe Caraccio

unread,
Aug 30, 2016, 2:24:45 PM8/30/16
to Firebase Google Group
Hey Everyone.. Just trying to get Facebook Auth working on my React Native app.. running version 3.3 of the Firebase api...


Whenever I try to call firebase.auth.FacebookAuthProvider it says that it is undefined. I know most of firebase is working as I am able to make pushs and pulls from the database.

        const provider = firebaseObj.auth.FacebookAuthProvider;


Any ideas? was this not added to the React Native library? or am I just doing something wrong? If so is there any other solutions? 


Thanks!



Jacob Wenger

unread,
Aug 30, 2016, 2:51:40 PM8/30/16
to fireba...@googlegroups.com
Hey Joe,

Would you mind sharing your initialization code for Firebase? That is, your call to firebase.initializeApp(). Make sure you are not passing a serviceAccount to the initialization and are instead using an apiKey. Check out my reply on this thread for some more details of how this works.

Lastly, your code sample looks incorrect. The correct code should be:

const provider = new firebase.auth.FacebookAuthProvider();

I am not sure what firebaseObj is in your code sample, but you should just be able to use the firebase object if you did an import firebase from 'firebase'. Full details on Facebook authentication with the Firebase web SDK are here.

Cheers,
Jacob

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/fc0f65e8-c728-4da7-afae-39884b1cdff4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Frank van Puffelen

unread,
Aug 30, 2016, 4:31:16 PM8/30/16
to Firebase Google Group


On Tuesday, August 30, 2016 at 11:51:40 AM UTC-7, Jacob Wenger wrote:
Hey Joe,

Would you mind sharing your initialization code for Firebase? That is, your call to firebase.initializeApp(). Make sure you are not passing a serviceAccount to the initialization and are instead using an apiKey. Check out my reply on this thread for some more details of how this works.

Lastly, your code sample looks incorrect. The correct code should be:

const provider = new firebase.auth.FacebookAuthProvider();

I am not sure what firebaseObj is in your code sample, but you should just be able to use the firebase object if you did an import firebase from 'firebase'. Full details on Facebook authentication with the Firebase web SDK are here.

Cheers,
Jacob
On Tue, Aug 30, 2016 at 11:08 AM, Joe Caraccio <jacar...@gmail.com> wrote:
Hey Everyone.. Just trying to get Facebook Auth working on my React Native app.. running version 3.3 of the Firebase api...


Whenever I try to call firebase.auth.FacebookAuthProvider it says that it is undefined. I know most of firebase is working as I am able to make pushs and pulls from the database.

        const provider = firebaseObj.auth.FacebookAuthProvider;


Any ideas? was this not added to the React Native library? or am I just doing something wrong? If so is there any other solutions? 


Thanks!



--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

Bassam

unread,
Aug 30, 2016, 5:45:49 PM8/30/16
to Firebase Google Group
I just tested it in a react native test app.
const provider = new firebase.auth.FacebookAuthProvider();
console.log(provider);

Works as expected.

Joe Caraccio

unread,
Aug 31, 2016, 10:59:44 AM8/31/16
to Firebase Google Group
yup, your right.. Feel like an idiot...

Trying to call the ".credential()" function that seems to be a method of that class..would that be as simple as provider.credential(token)?

Joe Caraccio

unread,
Aug 31, 2016, 10:59:45 AM8/31/16
to Firebase Google Group

Thanks.. your right... 
is there a specific way to access the "credential" method which seems to be part of that class or could i say provider.credential(token)?



On Tuesday, August 30, 2016 at 2:51:40 PM UTC-4, Jacob Wenger wrote:
Hey Joe,

Would you mind sharing your initialization code for Firebase? That is, your call to firebase.initializeApp(). Make sure you are not passing a serviceAccount to the initialization and are instead using an apiKey. Check out my reply on this thread for some more details of how this works.

Lastly, your code sample looks incorrect. The correct code should be:

const provider = new firebase.auth.FacebookAuthProvider();

I am not sure what firebaseObj is in your code sample, but you should just be able to use the firebase object if you did an import firebase from 'firebase'. Full details on Facebook authentication with the Firebase web SDK are here.

Cheers,
Jacob
On Tue, Aug 30, 2016 at 11:08 AM, Joe Caraccio <jacar...@gmail.com> wrote:
Hey Everyone.. Just trying to get Facebook Auth working on my React Native app.. running version 3.3 of the Firebase api...


Whenever I try to call firebase.auth.FacebookAuthProvider it says that it is undefined. I know most of firebase is working as I am able to make pushs and pulls from the database.

        const provider = firebaseObj.auth.FacebookAuthProvider;


Any ideas? was this not added to the React Native library? or am I just doing something wrong? If so is there any other solutions? 


Thanks!



--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

Joe Caraccio

unread,
Aug 31, 2016, 10:59:46 AM8/31/16
to Firebase Google Group
I just noticed in some of the Firebase code samples that it was called like this:

var credential = firebase.auth.FacebookAuthProvider.credential(
event.authResponse.accessToken);

Was that deprecated? when I do 
const provider = new firebase.auth.FacebookAuthProvider();
provider.credential(token)

it says provider.credential is not a function..

On Tuesday, August 30, 2016 at 5:45:49 PM UTC-4, Bassam wrote:

Bassam

unread,
Aug 31, 2016, 12:41:54 PM8/31/16
to Firebase Google Group
credential was always a javascript static method on auth providers.
You cannot initialize a provider instance and call credential on it.
There was a problem in the typescript definitions in the version before 3.3.0 which defined it as a method of auth provider but that was fixed.

Joe Caraccio

unread,
Aug 31, 2016, 1:30:57 PM8/31/16
to Firebase Google Group
Ahh okay, I guess much of this problem is I have never worked with an API like this in javascript..

So how do you recommend I set the credential since I can't call it from a provider instance, is there something I can call in a static fashion... very confused

Bassam

unread,
Aug 31, 2016, 2:13:28 PM8/31/16
to Firebase Google Group
Just initialize your facebook credential as follows: firebase.auth.FacebookAuthProvider.credential('facebookAccessToken');
Reply all
Reply to author
Forward
0 new messages