Retrieve Google authenticated user data in Firebase -
in documentation of firebase states
you create new user in firebase project calling createuserwithemailandpassword method or by signing in user first time using federated identity provider, such google sign-in or facebook login.
i'm using react-native-google-signin
library sign in , after 1 day of thinkering it's working. can see logged-in user data coming in after successful login.
but in firebase console, under authentication don't see new user added.
of course guess 1 way of handling looks like
googlesignin.signin().then(user => { // if user doesn't exist firebase.auth() .createuserwithemailandpassword(user.email, randompassowrd); })
but feels workaround , doc says can create new user in firebase signing in google... why not happening automatically?
this current implementation, think simplest possible way, sayd login successful , data flowing in.
googlesignin .configure({ iosclientid: ios_client_id }) .then(() => { googlesignin .signin() .then((user) => { console.log('user ->', user); dispatch(loginsuccessaction(user)) }) .catch((err) => { dispatch(loginfailaction()) }) .done(); }) .done();
if sign user firebase authentication google (or other provider), show in firebase authentication console.
the code shared doesn't sign user in firebase, indeed won't show in firebase console (nor have authenticated access firebase services). you're missing call firebase.auth().signinwithcredential(credential)
shown here: https://firebase.google.com/docs/auth/web/google-signin#advanced-handle-the-sign-in-flow-manually
Comments
Post a Comment