+12

How to Displaying logged email in firebase?

I have the code right here: https://code.sololearn.com/W4Ul2lDAsbP7/?ref=app But how to display ALL the created account?

5 Answers

New Answer

+9

Interesting question. Let me try before Burey or Martin answers your question. 1. If users data are general data, the way is something similar to this : const getInfo = () => { read("users", data=>{ for(let email in data.val()) { document.body.innerHTML += "<br/>"+ email; } }); }; But not sure, I checked Martin's script on Dropbox and made some edits based on guessing. Seems it works only if you upload the user data in specific format : "email/"+email+"pass/"+pass; 2. For the auth() methods, let me try to dig into the firebase doc 😋 Reference: https://firebase.google.com/docs/auth/android/password-auth Seems there is a getCurrentUser() method, but no method for client to see all registered email (otherwise too malicious, isn't it?)

+8

You cannot just display all accounts only using auth as far as I know, you would need to store the data you want using firebase database. And the just query it, like Gordon said. auth.createUserWithEmailAndPassword(email, password).then(function() { firebase.database.ref("Users/"+auth.currentUser.uid).set({ email: email, // or whatever data you want to store }); When all is stored you can just call firebase.database.ref("Users").once(function(v) { for(var uid in v.val()) console.log(JSON.stringify(v.val()[uid],nulll,4); }); -> I had a code doing the exact same thing but I deleted it sorry 😅

+7

Looks like people are going crazy with firebase !! Was also finding this one!

+3

Wach this video from A-Z Explain how ! https://youtu.be/iKlWaUszxB4

+1

nice