New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to setup google sign in with react-native-firebase? #275
Comments
You need to build your credential the following way: const credential = firebase.auth.GoogleAuthProvider.credential(idToken, accessToken); So you will need to get idToken from your oauth library of choice |
@Salakar I have tried doing it that way but doing so gives me error that the |
Ah, you'll need to upgrade your RNFirebase to the latest version - migration guide is over here - it's fairly straight forward |
@Salakar I have lots of code in iOS that is incompatible in the current but I tried making an empty project and doing it all from scratch but I'm still getting the same error that its undefined, please help :( Do you have any google sign in examples that use this library? and please it would be alot helpful if there is any fix for the version 1.1.2 |
@ShariqMush try using your initialised instance of firebase to access the e.g: import firebase from 'react-native-firebase';
const instance = firebase.intializeApp({
// your opts
});
// ...
const credential = instance.auth.GoogleAuthProvider.credential(idToken, accessToken); |
@Salakar Yes I tried, but right now after trying to migrate to v2, I'm getting some dex error
|
Please see the faqs on how to fix that problem :)
…On 31 Jul 2017 09:06, "Shariq Musharaf" ***@***.***> wrote:
@Salakar <https://github.com/salakar> Yes I tried, but right now after
trying to migrate to v2, I'm getting some dex error
com.android.dex.DexException: Multiple dex files define in android app
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#275 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAzZXl3u6rGBHXxaNGkvT9yGfislJptlks5sTYrvgaJpZM4OieR2>
.
|
@Ehesp I have tried all the info that was in the FAQ and also from the link that was provided there but nothing seems to work for me right now :(
|
I'd guess other dependancies still have dependancies towards Google Services. You need to go through them one by one, annoying issue but requires manual work which we can't really help with since it's project specific. |
@Ehesp I have checked through all of the dependencies, the place where I found |
It's not just the Google ones, any dependancy conflict will throw the error. |
@Ehesp Currently it is giving me this error
But I don't know how to update this, I took the code from the website provided here and put it in my dependencies but its still throwing the error. I'm now going to do as you said and will reply after trying as you said. |
@ShariqMush you should be asking for the same versions of the |
@chrisbianca Thanks for that! :) and now I'm back to
|
If you run |
@chrisbianca Thanks soo much!!! I can only see |
@ShariqMush Has this worked for you? If so, can we close the issue? |
@chrisbianca No, I'm still trying to sort the dex issue out, now I'm making an empty project and adding all the dependencies one by one and doing setup from the scratch to find out what is causing the conflict... It would be very greatful of you if you could try to reproduce the problem in an empty project in your side :) |
@ShariqMush As much as we'd like to, you'll have to work through this on your own - we know what the issue is and have provided steps to fix it. Unfortunately every project uses its own combination of modules and we don't have the resource to be able to go to such a level of detail with each specific configuration. |
@chrisbianca @Ehesp @Salakar I have now tried to install rn-firebase in an empty project and now I'm getting all these errors when I try to do
|
You need to bump the version of RNFirebase to 2.1.0. |
@chrisbianca @Ehesp @Salakar To debug, I installed both google-signin and rn-firebase packages in an empty project but now the app crashes on the launch and throws this error in the android logcat:
|
@chrisbianca @Salakar @Ehesp I skipped to update the rn-firebase and continued with 1.1.2 and then I implemented the google signin correctly and used the
Here is the issue where I got this help from: react-native-google-signin/google-signin#263 |
@ShariqMush you'll need to get it from provider data, see https://firebase.google.com/docs/auth/web/manage-users#get_a_users_provider-specific_profile_information |
Hi. I'm assuming you have both libraries setup correctly. |
@Salakar @Ehesp @chrisbianca Thank you for your help guys!! I have managed to make it work with |
@ShariqMush To clarify, you needed |
Yes, RNFirebase doesn't do anything to get you a token, it just provides a means to sign in with a token from elsewhere. |
Just a question, can i use firebase package instead of react-native-firebase for google authentication like this? Or i still need to use this library? |
You need Google sign in before Firebase Here is a snippet that signs you in, since I saw some examples using only idToken which can be null and you can use accessToken too
|
Plss ,, Someone get me the full code..... |
@pravinraut809 it's basically above you. |
Sir,, want the full code .. |
Also for phone auth |
@pravinraut809 if you want a full code example, consider purchasing our auth starter kit which has everything set up for you: https://rnfirebase.io/kits/auth-starter |
Hello, I'm trying to authenticate with firebase auth using react-native-firebase library but seems like there are lots of issues coming in, I have not initialized webClientId or defined it and what I'm doing right now is that I'm currently sending my accessToken like this:
and here is my authentication firebase code:
Upon running, it throws me this error:
> User signin error Error: An internal error has occurred. [ Unable to parse Google id_token: -accessToken-
And then I did some research on how I can fix this and turns out that some articles said that I need idToken which I do not know how to get, I have not initialized my webClientId yet so that is the reason I think I'm currently getting null at, I do not know how to set that up so I tried to edit my config method like this which did not give me any tokenId:
so after all these attempts and seaching up the whole github I was not able to find any solution so this is the last thing but I since there are 74 issues which are open I don't think that this will be solved here so easily but please if you know the solution to this please answer. Thank you!
The text was updated successfully, but these errors were encountered: