firebase-auth-basics

Configure Firebase Authentication providers and implement user sign-in flows for web applications.

Updated Aug 5, 2024
One-click install
npx skills add https://github.com/nikhilkakarla/nikhilkakarla.github.io --skill firebase-auth-basics-nikhilkakarla
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: firebase-auth-basics
Source: https://github.com/nikhilkakarla/nikhilkakarla.github.io/tree/main/.agents/skills/firebase-auth-basics
Command: npx skills add https://github.com/nikhilkakarla/nikhilkakarla.github.io --skill firebase-auth-basics-nikhilkakarla

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Setting up user authentication involves many moving parts: enabling identity providers, integrating client SDKs, handling tokens, and writing security rules. This Skill guides you through the complete Firebase Authentication setup so your app can securely sign in and manage users. ## Core Features & Use Cases - Provider Provisioning: Enable Email/Password, Google, and Anonymous auth via the Firebase CLI configuration, or set up other providers in the Firebase Console. - Web Client Integration: Implement sign-in flows for Google, Facebook, Apple, Twitter, GitHub, Microsoft, Yahoo, email/password, email link, and anonymous auth using the Firebase Web SDK. - Security Rules: Protect Firestore and Storage data using request.auth checks for signed-in users, ownership, and email verification. - Use Case: You are building a web app that needs user accounts. Use this Skill to enable Google Sign-In, wire up the client SDK with an auth state listener, and write security rules so users can only access their own data. ## Quick Start Set up Firebase Authentication in my web app with Google Sign-In and email/password login, including the client SDK code and security rules.

Frequently Asked Questions about firebase-auth-basics

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Firebase Authentication in a web app?▼

Enable providers in firebase.json or the Firebase Console, then initialize the Auth service with getAuth(app) from the firebase/auth SDK. Implement sign-in flows such as signInWithPopup for Google or createUserWithEmailAndPassword for email accounts.

How to add Google Sign-In with Firebase Auth?▼

Create a GoogleAuthProvider instance and call signInWithPopup(auth, provider) from the Firebase Web SDK. Enable the Google provider first via the auth block in firebase.json or in the Firebase Console.

Which Firebase Auth providers can be enabled via CLI?▼

Only Google Sign-In, anonymous auth, and email/password auth can be enabled through the Firebase CLI by adding an auth block to firebase.json. All other providers, such as Facebook or Apple, must be enabled in the Firebase Console.

How do I detect if a user is signed in with Firebase?▼

Use onAuthStateChanged(auth, callback) from the Firebase Web SDK. The listener fires whenever the user signs in or out, giving you the current user object or null, and is the recommended way to track auth state.

How do Firebase security rules check user authentication?▼

Security rules access the request.auth variable, which is null for signed-out users. Use request.auth.uid to verify data ownership and request.auth.token claims like email_verified to enforce conditions such as verified email before writes.

Can I test Firebase Authentication locally with an emulator?▼

Yes, connect to the Authentication emulator using connectAuthEmulator(auth, "http://localhost:9099") right after initializing the Auth service. This lets you test sign-in flows locally without touching production users.