firebase

how to edit an array element present in firestore [duplicate]

杀马特。学长 韩版系。学妹 提交于 2021-02-17 07:03:49
问题 This question already has answers here : Flutter: Update specific index in list (Firestore) (1 answer) Flutter: How to update an Array within an Array in the firestore (1 answer) Closed 9 months ago . I have an array of strings present in firestore. I want to edit the string present at a particular index. How can I do this? For example, let the array be ["help","me","please"]; How can I change "help" to "don't help" in flutter? The closest I've gotten to editing the array is adding an element

Add additional data to user profile via firestore functions onCreate

删除回忆录丶 提交于 2021-02-17 07:01:12
问题 I'm trying to automatically create a user data in my firestore db when user sign up through firestore functions. However I got 2 option for sign up. Bussiness account and personal account. If user signup as bussiness then I want to add "usertype = 1" into my document and when personal then "usertype=2" I managed to automaticaly create a document on signup via functions const functions = require('firebase-functions') const admin = require('firebase-admin') admin.initializeApp() const db =

Using Firebase Firestore with mobile clients directly is secure enough? How can I avoid malicious requests and excessive requests exceeding limits?

僤鯓⒐⒋嵵緔 提交于 2021-02-17 06:52:11
问题 I have some concerns about using Firestore directly from mobile clients. I saw that with Firestore, mobile app is controls to db directly. There is only db side control is rules. However I am not yet understand how can I resolve my concerns. I worrying because with decompiling app or any other ways maybe someone can access maliciously. To resolve my concerns and improve the security I want to: Limit access per time for user. For example if some one writes or reads db 30 second ago I want to

How can I check if a value e.g. name exists in a collection within any of documents in Cloud Firestore?

妖精的绣舞 提交于 2021-02-17 06:44:05
问题 I want to check if a value e.g. (name: ‘John’) exists in the collection of any document in my Cloud Firestore, because if it does I do not want to create a new document with that name (in this case ‘John’). How can I check if the name exists? 回答1: Assuming you have in Firestore a collection called "users", to check if a user with the name of "John" already exists, please use the following lines of code: FirebaseFirestore rootRef = FirebaseFirestore.getInstance(); CollectionReference usersRef

Firebase-Admin when updating user's email user gets logout if page is refreshed

风格不统一 提交于 2021-02-17 06:44:05
问题 When updating user's email using admin.auth().updateUser({email: newEmail}) the user's email gets updated (as an authentication provider). But whenever I refresh the page, the user gets logout. Is there a way I can prevent that from happening and keeping the user logged in after its email gets updated? 回答1: Firebase treats the email address as its primary way of finding the account for a user when you don't (yet) have their UID. For that reason the email address is considered sensitive

Add nested data in Firestore by flutter

倖福魔咒の 提交于 2021-02-17 06:30:27
问题 I'm from following issue. How to manage add and update data in Firebase Initially I can make data in firestore following code. However I would like to add car2 inside of cars after car1 . I have no idea of it. _firestore.collection('members').document(${loginUser.uid}).setData({ 'cars': { 'car1': { 'name': name, 'img_url': 'https://www.xxx.xxx/xxx.png', 'details': { 'type': carType, } } } Please give me advice. 回答1: To add cars2 , then do the following: _firestore.collection('members')

Can't assign a value to variable inside of closure Swift [duplicate]

冷暖自知 提交于 2021-02-17 06:24:08
问题 This question already has answers here : Returning data from async call in Swift function (11 answers) Closed 9 months ago . I'm trying to get current document count belongs to spesific user from Firebase. Whenever i try to assign count value to my variable in closure, value is always shown as nill. So that i did couple of research, as a result i figured out networking sometimes takes so long and it happens asynchronously. So if i'm not wrong due to asynchronous returning a value inside a

Limit Firebase Cloud Function To IP Addresses

五迷三道 提交于 2021-02-17 06:17:04
问题 I have several Cloud Functions that are all setup and working well, each of type https.onRequest(... . I am trying to figure out the best / easiest way to allow the https.onRequest functions to be called only by specified IP addresses. Can this be accomplished? I am guessing I need to create a service account with conditions, but I haven't been able to achieve the results I want. 回答1: You could use a GCE VM as proxy with a firewall rule to only accept incoming traffic form the IP that you

Referencing Firebase realtime database data through firestore security rules

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-17 06:14:06
问题 I would like to use data in the realtime database to allow user access in the firestore database. Is it possible to reference nodes in the realtime database from the firestore security rules? 回答1: It is currently not possible to cross between database products like this in security rules. Please feel free to file a feature request for this. You can, however, write code to run on Cloud Functions that deals with database changes after the change has happened, and undo or restrict the change

Uncaught Error: Call to undefined method Kreait

让人想犯罪 __ 提交于 2021-02-17 06:11:50
问题 I just created php web server and connected it to firebase. when I tried authentication, Sign up works just fine. but the problem is in Sign in. it keeps getting this error: Fatal error: Uncaught Error: Call to undefined method Kreait\Firebase\Auth::signInWithEmailAndPassword() in /Applications/XAMPP/xamppfiles/htdocs/firebase_series/authActions.php:24 Stack trace: #0 {main} thrown in /Applications/XAMPP/xamppfiles/htdocs/firebase_series/authActions.php on line 24 here my authentication code: