DEV Community

Cover image for My Journey with Firebase Authentication
Grace Kuti
Grace Kuti

Posted on

My Journey with Firebase Authentication

Lessons learned building scalable auth systems for real-world apps. My first time using Firebase was a little nerve-wrecking to say the least, it were as if the entire console was screaming in my face. Although intimidated I dove in head-first and realized I was afraid for nothing.

At first I was asking Gemini for EVERYTHING from how to set up a database to how to deploy my web-apps. But over time I started getting more familiar with it, although I may have forgotten how to set up admins more times than I'd like. I eventually learned that Firebase doesn’t have ‘roles’ built-in. You have to manage admin users either with custom claims or store roles in Firestore. That realization saved me a lot of repeated headaches.

This is how I first logged in a user
`import { initializeApp } from "firebase/app";
import { getAuth, signInWithEmailAndPassword } from "firebase/auth";

const firebaseConfig = {
apiKey: "YOUR_API_KEY",
authDomain: "your-app.firebaseapp.com",
projectId: "your-app",
storageBucket: "your-app.appspot.com",
messagingSenderId: "SENDER_ID",
appId: "APP_ID"
};

// Initialize Firebase
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);

// Example login
signInWithEmailAndPassword(auth, "user@example.com", "password123")
.then(userCredential => {
console.log("Logged in:", userCredential.user);
})
.catch(error => {
console.error("Error:", error.message);
});`

Overall Firebase has made it very simple for me to navigate through it and understand the basics. Through this I realized that I created a mental block in my own head, a limit of some sorts up until I decided to throw myself off the deep-end, I sure am glad I did that. If you’re just starting with Firebase (or any new tool), don’t let fear hold you back. Dive in, break things, and you’ll learn faster than you think.

Top comments (0)