firebase

Firebase Cloud Function - Create user with extra information

北城余情 提交于 2021-02-11 13:56:17
问题 I am currently looking for the best way to create a user with additional information in a cloud function. The obvious possibility seems to create a trigger which creates a user document: functions.auth.user().onCreate((user) => { /* Create user document in firestore with base information*/ }); And afterwards add the information to the created document. (Handle the promise) But one way or another I don't feel really satisfied with this solution. I would rather do all this stuff in one go. Does

changes made to firebase currentUser is not reflected until full reload of the application [duplicate]

孤者浪人 提交于 2021-02-11 13:48:05
问题 This question already has an answer here : change displayName of the currentUser in firebase [closed] (1 answer) Closed 10 months ago . I want to update displayName of the current user and display it on screen. firebase .auth() .createUserWithEmailAndPassword(email, password) .then((response) => {response.user.updateProfile({displayName: 'John Doe'}),response.user.reload()}) .catch(error => Alert.alert('', error.message)); console.log(firebase.auth().currentUser.displayName); using this code

Firebase hosting restricted access

狂风中的少年 提交于 2021-02-11 13:46:31
问题 Can we restrict access to website with firebase hosting to prevent search engine indexing? This would be helpful for dev/staging environments. Something like AWS Amplify restricting access https://docs.aws.amazon.com/amplify/latest/userguide/access-control.html 回答1: You can control whether a crawler indexes your site with the usual robots.txt instructions. Note that this file is not specific to Firebase Hosting, and commonly used to control if/what parts of a site bots crawl. But aside from

Query Firestore collection based on negation

岁酱吖の 提交于 2021-02-11 13:38:46
问题 We are developing a messaging system where the users are able to block each other. This means we need the ability to query message where the author is not blocked. Pseudo: Select * from messages where author_id not in {list_of_blocked_ids} Since Firestore does not support array_not_contains or any other negation-methods we are quite unsure how to structure this data to be able to make this query. Any help structuring this information about blocked users is appreciated. 回答1: To solve this

Firebase emulator cloud function throws cors error when hit from frontend

僤鯓⒐⒋嵵緔 提交于 2021-02-11 13:36:27
问题 I have this function that works perfectly in production however when running locally I get cors errors export const listUsers = functions.https.onRequest(async (req, res) => { res.set("Access-Control-Allow-Origin", "*") const data = await getSomeUsers(10) res.json(data) }) emulators starts fine: cors issue: 回答1: Check this: Deadly CORS when http://localhost is the origin Chrome does not support localhost for CORS requests (a bug opened in 2010, marked WontFix in 2014). To get around this you

Verify a user's email address before confirming registration, with Flutter and Firebase

女生的网名这么多〃 提交于 2021-02-11 13:33:07
问题 I've created a login and registration screen that works with my Flutter app, using Firebase as the backend authentication service. I'm able to switch between the login, registration and reset password screens well. The Issue At the moment, the registration screen accepts any email address that is entered, whether or not it is real. For example, if I were to type in gvevg@gverwbgw.com, it would allow the user to register. This is obviously an issue, when it comes to fake accounts and spam etc.

Firestore - how to get the total number of records in a collection like we are doing in sql [duplicate]

…衆ロ難τιáo~ 提交于 2021-02-11 13:28:47
问题 This question already has answers here : Cloud Firestore collection count (17 answers) Closed 2 years ago . db.collection("cities").get().then(function(querySnapshot) { console.log(querySnapshot.size); }); but the problem is I am using pagination and load 30 records for each call. so I am unable to get the total numbers of records. Is there any way to get it ? like, we are doing in sql. 回答1: How to get the total number of records in a collection with Firebase ? The method numChildren() do

Firebase, get specfic chid from parent

假如想象 提交于 2021-02-11 13:27:27
问题 I want to match branch value in all child of student nodes with the value I already have and if matched successfully then I want to retrieve 'Student name' value in matched child see blow image 回答1: You're looking for a query in that case. To match the value of branch and then print the value of studentName for all matching child nodes, you'd do: DatabaseReference ref = FirebaseDatabase.getInstance().getReference(".../students"); Query query = ref.orderByChild("branch").equalTo("Electronics

Firebase, get specfic chid from parent

笑着哭i 提交于 2021-02-11 13:27:00
问题 I want to match branch value in all child of student nodes with the value I already have and if matched successfully then I want to retrieve 'Student name' value in matched child see blow image 回答1: You're looking for a query in that case. To match the value of branch and then print the value of studentName for all matching child nodes, you'd do: DatabaseReference ref = FirebaseDatabase.getInstance().getReference(".../students"); Query query = ref.orderByChild("branch").equalTo("Electronics

React-bootstrap-table2 doesn't show data from Firebase

扶醉桌前 提交于 2021-02-11 13:22:21
问题 I've been trying to retrieve data from Firebase Realtime Database and display it in a react-bootstrap-table2, but I've run into some issues when it comes to actually displaying the data. When I run the code no value is printed into the table, however, there is no error in console. If I set the number of displayed values in the table to 25, an error occurs: Uncaught TypeError: Cannot read property 'timestamp' of undefined. However, if I console.log timestamp I first get an empty array and then