🔥 Free Firestore CRUD Queries Cheatsheet 👉 Get the PDF ×
Firebase Version 9 Tutorial (Modular)
INTRODUCTION
Add Firebase 10 to JavaScript Web App new
Add Firebase SDK via CDN coming soon
FIRESTORE DATABASE
Firebase 10 ADD DATA addDoc() new
Firebase 10 ADD DATA setDoc() new
Firebase 10 UPDATE DATA setDoc() new
Firebase 10 UPDATE DATA updateDoc() new
Firebase 10 DELETE Document Field updateDoc() new
Firebase 10 DELETE Document delectDoc() new
Firebase 10 GET all Documents getDocs() new
Firebase 10 GET All Documents With Real-Time Updates onSnapshot() new
Firebase 10 GET A Document By ID getDoc() new
Firebase 10 v9 vs v8 Query Comparison new
🔐 FIREBASE AUTHENTICATION
Firebase 10 Create A User Account using createUserWithEmailAndPassword() new
Firebase 10 Check User Authentication State Using onAuthStateChanged()new
Firebase 10 Sign In A User Account Using signInWithEmailAndPassword()new
Firebase 10 Sign Out A User Using signOut()new
Firebase 10 Get User Data From Cloud Firestore new
Firebase Version 8 Tutorial (Namespaced)
REAL-TIME DATABASE (RTDB)
Build A CRUD Web App With RTDB Part #1
Build A CRUD Web App With RTDB Part #2
Real-Time Database Querying, Sorting & Filtering
CLOUD FIRESTORE
Cloud Firestore Querying, Sorting & Filtering
Cloud Firestore Get Logged-in User Data
Cloud Firestore Partially Update A Document
SECURITY RULES (FIRESTORE)
5 Must-Know Security Rules Explained
CLOUD FUNCTIONS
Create Your First Cloud Function (HTTP Trigger)
Send Email Using Firebase Functions & Nodemailer
Add Subscriber To MailChimp Using Cloud Functions
VUE JS + FIREBASE
Create A Login Page Quickly Using FirebaseUI
Build A Complete To-Do Authentication App
Learn Role Based Authentication & Authorization
Create Stripe Checkout Payment Form
Track Users Location Real-Time
Deploy Vue.js App To Firebase Hosting
Last modified on October 13th, 2025
Raja Tamil
695 views
Authentication Firebase Javascript
695
How to Get Logged-In User Data by UID in Firestore (Firebase Auth) - YouTube
Tap to unmute
How to Get Logged-In User Data by UID in Firestore (Firebase Auth) SoftAuthor
SoftAuthor2.12K subscribers
Learn how to get user data from the Cloud Firestore in Firebase 9 (the latest version). 1
To get the user data from the Cloud Firestore, you’ll typically need to have the user authentication functionality in place using Firebase Authentication.
Secondly, you’ll also need to add user data to the Cloud Firestore Database upon creating a new user account.
At this stage, I assume you’ll know how to create a Firebase project and add the Firebase SDK initialization code to your web app.
1. Create A New User Account
First, create a new user account in the Firebase Authentication back-end.
For more:
1. Create User With Email And Password 2. Authentication State Changed 3. Sign In A User With Email And Password
<form>
<input type="email" id="email" placeholder="Email"/>
<input type="password" id="password" placeholder="Password"/>
<button id="signup-btn">Create Account</button>
</form>
<script type="module">
import {
getAuth,
createUserWithEmailAndPassword,
} from "https://www.gstatic.com/firebasejs/10.0.0/firebase-auth.js";
const auth = getAuth();
const email = document.getElementById("email");
const password = document.getElementById("password");
const signUpBtn = document.getElementById("signup-btn");
const signUpButtonPressed = async (e) => {
e.preventDefault();
try {
const userCredential = await createUserWithEmailAndPassword(
auth,
email.value,
password.value
);
console.log(userCredential);
} catch (error) {
console.log(error);
}
};
signUpBtn.addEventListener("click", signUpButtonPressed);
</script>
HTML
Copy
2. Add User Data
Add user data to the Cloud Firestore right after the user account is created using the currently logged-in user’s uid as a document ID.
...
import {
getFirestore,
doc,
setDoc,
} from "https://www.gstatic.com/firebasejs/10.0.0/firebase-firestore.js";
const db = getFirestore();
...
const signUpButtonPressed = async (e) => {
e.preventDefault();
try {
const userCredential = await createUserWithEmailAndPassword(
auth,
email.value,
password.value
);
// Add User Data
const docRef = doc(db, "users", userCredential.user.uid);
await setDoc(docRef, {
email: email.value,
});
// Add User Data
} catch (error) {
console.log(error);
}
};
signUpBtn.addEventListener("click", signUpButtonPressed);
JavaScript
Copy
3. Get User Data
Get user data when a user signs in to an existing account from the Firebase Authentication using the currently logged-in user’s uid as a document id.
import {
...
getDoc,
} from "https://www.gstatic.com/firebasejs/10.0.0/firebase-firestore.js";
const auth = getAuth();
const db = getFirestore();
const getUserData = async () => {
try {
const docRef = doc(db, "users", auth.currentUser.uid);
const docSnap = await getDoc(docRef);
console.log(docSnap.data());
} catch (error) {
console.log(error.code);
}
}
getUserData();
JavaScript
Copy
Disqus Recommendations
We were unable to load Disqus Recommendations. If you are a moderator please see our troubleshooting guide.
❮
- 8 months ago
In this FREE course, you're going to learn how to build a simple real-world …
- 3 years ago
Learn how to sign out or log out users of their current authentication using …
- 3 years ago
Learn how to authenticate a user account using the …
- 3 years ago
Learn how to use createUserWithEmailAndPassword() to create a new Firebase …
- 4 months ago
Learn how to model Firestore data the right way for performance, cost, and …
- 3 years ago
- 1 comment
The onAuthStateChanged() method is triggered when a user's authentication state …
❯
tempest.services.disqus.com
tempest.services.disqus.com is blocked
This page has been blocked by an extension
- Try disabling your extensions.
ERR_BLOCKED_BY_CLIENT
Reload
This page has been blocked by an extension
Disqus Comments
We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
G
Start the discussion…
Comment
Log in with
or sign up with Disqus or pick a name
Disqus is a discussion network
- Don't be a jerk or do anything illegal. Everything is easier that way.
Read full terms and conditions
This comment platform is hosted by Disqus, Inc. I authorize Disqus and its affiliates to:
- Use, sell, and share my information to enable me to use its comment services and for marketing purposes, including cross-context behavioral advertising, as described in our Terms of Service and Privacy Policy, including supplementing that information with other data about me, such as my browsing and location data.
- Contact me or enable others to contact me by email with offers for goods or services
- Process any sensitive personal information that I submit in a comment. See our Privacy Policy for more information
Acknowledge I am 18 or older
Discussion Favorited!
Favoriting means this is a discussion worth sharing. It gets shared to your followers' Disqus feeds, and gives the creator kudos!
Tweet this discussion
- Share this discussion on Facebook
- Share this discussion via email
- Copy link to discussion
Be the first to comment.
live.rezync.com
live.rezync.com is blocked
This page has been blocked by an extension
- Try disabling your extensions.
ERR_BLOCKED_BY_CLIENT
Reload
This page has been blocked by an extension
pippio.com
pippio.com is blocked
This page has been blocked by an extension
- Try disabling your extensions.
ERR_BLOCKED_BY_CLIENT
Reload
This page has been blocked by an extension
Twitter Widget Iframe