Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
460 views
in Technique[技术] by (71.8m points)

firebase - 有没有一种方法可以基于Firebase Auth用户信息更新Firestore文档字段?(is there a way to update firestore document fields based on a firebase Auth user info?)

I have successfully added some users' information in firestore documents.

(我已在Firestore文档中成功添加了一些用户信息。)

And I have a flutter app where the Client can enter some information after registration, I want to use that information provided to match/link the authenticated user to firestore using a field in the user document, is that possible?

(我有一个Flutter应用程序,客户可以在注册后输入一些信息,我想使用提供的信息来通过用户文档中的字段将经过身份验证的用户匹配/链接到firestore,这可能吗?)

note: - the data in firestore is created before the user registration.

(注意:-Firestore中的数据是在用户注册之前创建的。)

which means the registered user uid is different from the one created in firestore

(这意味着注册用户uid与在firestore中创建的用户uid不同)

I would appreciate help in this regard, what is the proper code to do so?

(在这方面,我将不胜感激,这样做的正确代码是什么?)

I'm pretty new to this.

(我对此很陌生。)

user in firestore document id

(用户在Firestore文档ID中)

user uid from firebase

(Firebase中的用户uid)

  ask by Nouas translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

您可以创建另一个集合,并使用documentId与uid。相同的文档存储其他信息,以便您可以使用uid通过已认证用户查询集合。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...