0
votes

I have simple method to register user from simple creating account in my app bu using Auth.auth().createUser(withEmail: email, password: password)... & it's works well. To set sign Up users more comfortable - i want to implement google sign in & i made it. as Frank suggested - it's does not automatically add user data to Firestore & i should to create document for each user in Firestore method. After search a lot of documents, i have made trigger:

exports.handleNewSignups = functions.auth.user().onCreate(async user => {
  const { uid, displayName, email } = user
  const username = displayName;
  const profileImageUrl = "1.jpg";
  const keywords = username.split('');
  const bio = "";

  return await admin
    .firestore()
    .collection("users")
    .doc(uid)
    .set({ bio, keywords, email, profileImageUrl, uid, username })
})

And now it's create a new document when user press sign in with google in my app, great! But it's look like issue which i don't know how to solve - document this user info is creating in firestore - correct, i can see this account in authentication section in firebase, but: user in my app after signinig in with google - cannot see everything in this own account.

After that im logout with this account & trying to sign in with users email & password from google (email is correct) but i see error that password is empty or incorrect. I try many times.

And only when im trying to restore user's password & creating new password from firestore service - everything is good & looks normally. Maybe its real generate automatically password to user or pass it from google auth?

How can i implement something to make it work? (If available - with example please). Sorry maybe for noob question, but i'm stuck.

1
It's not clear what you mean by "user in my app after signinig in with google - cannot see everything in this own account". Please edit the question to show the specific code that isn't working the way you expect, and explain in more detail what you observe. There should be enough information in your question so that anyone can reproduce and observe. - Doug Stevenson
That doesn't really help - please edit the question to explain in more detail. - Doug Stevenson
I mean view is empty) - no username, photo, etc. but this document already exists in firebase. - Pasha Fateev
Please show your code of display user data - Ashish
question adided - Pasha Fateev

1 Answers

0
votes

Thx a lot for everyone. Problem was with user image, im just addeded notification center to avatar after sigining in and now works perfect