- Target Platform (e.g. iOS, Android): Android
- Development Operating System (e.g. macOS Sierra, Windows 10): Windows 10
- Build tools (Xcode or Android Studio version, iOS or Android SDK version, if relevant):
- React Native version (e.g. 0.45.1): 0.45
- RNFirebase Version (e.g. 2.0.2): 1.1.2
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:
GoogleSignin.signIn().then((user) => {
console.log(user);
this.setState({user: user});
console.log(user.token+" token");
const credential = {
provider: 'google',
token: user.accessToken,
secret: user.id, //I do not know what to send in secret
};
Authentication.googleLogin(credential);
})
.catch((err) => {
alert('WRONG SIGNIN'+ err);
})
.done();
and here is my authentication firebase code:
static googleLogin(getCredentials) {
//this.setState({user: user});
firebase.auth().signInWithCredential(getCredentials)
.then((user) => {
console.log('User successfully signed in', user)
})
.catch((err) => {
console.error('User signin error', err);
});
}
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:
_configureOauth(clientId, scopes=[]) {
GoogleSignin.configure(
"myIdhere",
[], // I do not know what to put here either
"https://my-app.firebaseio.com/auth" //I also tried without auth
);
}
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!
You need to build your credential the following way:
So you will need to get idToken from your oauth library of choice
@ShariqMush try using your initialised instance of firebase to access the
auth.GoogleAuthProvider
using the module one fromimport firebase from 'react-native-firebase';
won’t work – at least not in v1.1.2.e.g:
…
@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>
.
Plss ,, Someone get me the full code…..
Sir,, want the full code ..
Also for phone auth