firebase-auth-basics

Richten Sie Firebase-Authentifizierung mit mehreren Identitätsanbietern und sicherem Datenzugriff ein. Unterstützt E-Mail/Passwort, Telefonnummer, anonyme, föderierte Anbieter (Google, Facebook, Twitter, GitHub, Microsoft, Apple) und benutzerdefinierte Authentifizierungsintegration. Benutzer werden durch eindeutige UIDs mit optionalen Eigenschaften wie E-Mail, Anzeigename, Foto-URL und E-Mail-Verifizierungsstatus identifiziert. Die Authentifizierung über CLI ermöglicht Google Sign-In, anonyme Authentifizierung und E-Mail/Passwort; andere Anbieter erfordern Firebase...

npx skills add https://github.com/firebase/skills --skill firebase-auth-basics

Prerequisites

  • Firebase Project: Created via npx -y firebase-tools@latest projects:create (see firebase-basics).
  • Firebase CLI: Installed and logged in (see firebase-basics).

Core Concepts

Firebase Authentication provides backend services, easy-to-use SDKs, and ready-made UI libraries to authenticate users to your app.

Users

A user is an entity that can sign in to your app. Each user is identified by a unique ID (uid) which is guaranteed to be unique across all providers. User properties include:

  • uid: Unique identifier.
  • email: User's email address (if available).
  • displayName: User's display name (if available).
  • photoURL: URL to user's photo (if available).
  • emailVerified: Boolean indicating if the email is verified.

Identity Providers

Firebase Auth supports multiple ways to sign in:

  • Email/Password: Basic email and password authentication.
  • Federated Identity Providers: Google, Facebook, Twitter, GitHub, Microsoft, Apple, etc.
  • Phone Number: SMS-based authentication.
  • Anonymous: Temporary guest accounts that can be linked to permanent accounts later.
  • Custom Auth: Integrate with your existing auth system.

Google Sign In is recommended as a good and secure default provider.

Tokens

When a user signs in, they receive an ID Token (JWT). This token is used to identify the user when making requests to Firebase services (Realtime Database, Cloud Storage, Firestore) or your own backend.

  • ID Token: Short-lived (1 hour), verifies identity.
  • Refresh Token: Long-lived, used to get new ID tokens.

Workflow

1. Provisioning

Option 1. Enabling Authentication via CLI

Only Google Sign In, anonymous auth, and email/password auth can be enabled via CLI. For other providers, use the Firebase Console.

Configure Firebase Authentication in firebase.json by adding an 'auth' block:

{
  "auth": {
    "providers": {
      "anonymous": true,
      "emailPassword": true,
      "googleSignIn": {
        "oAuthBrandDisplayName": "Your Brand Name",
        "supportEmail": "[email protected]",
        "authorizedRedirectUris": ["https://example.com", "http://localhost"]
      }
    }
  }
}

[!NOTE] If the Google Sign-In popup opens and immediately closes with the error [firebase_auth/unauthorized-domain], it means the domain is not authorized. For local development, ensure localhost is included in the Authorized Domains list in the Firebase Console or via the authorizedDomains field in firebase.json. CRITICAL: Do NOT include the protocol or port number in the Authorized Domains list (e.g., use localhost, NOT http://localhost:9090).

CRITICAL: After configuring firebase.json, you MUST deploy the auth configuration to the Firebase backend for the changes to take effect. This is essential for auth providers like Google Sign-In, email/password, etc. to auto-generate the necessary OAuth clients for your app platforms. Run:

npx -y firebase-tools@latest deploy --only auth

Option 2. Enabling Authentication in Console

Enable other providers in the Firebase Console.

  1. Go to the https://console.firebase.google.com/project/_/authentication/providers
  2. Select your project.
  3. Enable the desired Sign-in providers (e.g., Email/Password, Google).

2. Client Setup & Usage

Web See references/client_sdk_web.md.

Flutter See references/flutter_setup.md. Android (Kotlin) See references/client_sdk_android.md.

3. Security Rules

Secure your data using request.auth in Firestore/Storage rules.

See references/security_rules.md.

Mehr Skills von firebase

firebase-remote-config-basics
firebase
Umfassender Leitfaden für Firebase Remote Config, einschließlich Vorlagenverwaltung und SDK-Nutzung. Verwenden Sie diese Fähigkeit, wenn der Benutzer Hilfe bei der Einrichtung von Remote Config, der Verwaltung von Feature-Flags oder der dynamischen Aktualisierung des App-Verhaltens benötigt.
officialdevelopmentapi
developing-genkit-dart
firebase
Einheitliches AI SDK für Dart, das Codegenerierung, strukturierte Ausgaben, Tools, Flows und Agents ermöglicht. Bietet Kern-APIs für Generierung, Tool-Definition, Flow-Orchestrierung, Embeddings und Streaming mit einer einzigen Schnittstelle. Enthält 8+ Plugins für LLM-Anbieter (Google Gemini, Anthropic Claude, OpenAI GPT), Firebase AI, Model Context Protocol, Chrome-Browser-Integration und HTTP-Server-Hosting über Shelf. Integrierte CLI mit lokaler Entwicklungs-UI für Flow-Ausführung, Tracing, Modellexperimentierung und...
official
developing-genkit-go
firebase
Entwickeln Sie KI-gestützte Anwendungen mit Genkit in Go. Verwenden Sie dies, wenn der Benutzer darum bittet, KI-Funktionen, Agents, Flows oder Tools in Go mit Genkit zu erstellen, oder wenn Sie mit…
official
developing-genkit-js
firebase
Erstellen Sie KI-gestützte Node.js/TypeScript-Anwendungen mit Genkit-Flows, Tools und Multi-Modell-Unterstützung. Genkit ist anbieterneutral; unterstützt Google AI, OpenAI, Anthropic, Ollama und andere LLM-Anbieter über Plugins. Definieren Sie Flows mit typsicheren Schemas mit Zod, führen Sie Generierungsanfragen aus und erstellen Sie mehrstufige KI-Workflows in TypeScript. Erfordert Genkit CLI v1.29.0+; aufgrund aktueller größerer API-Änderungen müssen Sie die Genkit-Dokumentation:read und common-errors.md für aktuelle Muster konsultieren, nicht auf früherem Wissen basieren...
official
developing-genkit-python
firebase
Entwickeln Sie KI-gestützte Anwendungen mit Genkit in Python. Verwenden Sie dies, wenn der Benutzer nach Genkit, KI-Agenten, Flows oder Tools in Python fragt oder wenn er auf Genkit stößt…
official
firebase-ai-logic
firebase
We need to translate the given English text into German, preserving the name "firebase-ai-logic" but it's not in the text. The instruction says: "Do not include the name unless it appears in the source text." The name does not appear in the source text, so we don't include it. We just translate the text inside <text>. Also preserve product names, protocol names, URLs, numbers, technical terms. So "Gemini", "Gemini Nano", "Chrome", "Cloud Storage", "App Check" should remain as is. Translate the rest naturally. Let me translate: "Client-side Gemini integration for web apps with multimodal inference, streaming, and on-device hybrid execution." -> "Clientseitige Gemini-Integration für Web-Apps mit multimodaler Inferenz, Streaming und hybrider Ausführung auf dem Gerät." "Supports text-only and multimodal inputs (images, audio, video, PDFs); files over 20 MB route through Cloud Storage" -> "Unterstützt reine Texteingaben und multim
official
firebase-ai-logic-basics
firebase
Offizielle Fähigkeit zur Integration von Firebase AI Logic (Gemini API) in Webanwendungen. Behandelt Einrichtung, multimodale Inferenz, strukturierte Ausgabe und Sicherheit.
official
firebase-app-hosting-basics
firebase
Bereitstellen und Verwalten von Full-Stack-Web-Apps mit Firebase App Hosting unter Verwendung von Next.js, Angular und anderen unterstützten Frameworks. Erfordert ein Firebase-Projekt im Blaze-Tarif; unterstützt Server-Side Rendering (SSR) und Incremental Static Regeneration (ISR)-Workflows. Bereitstellung über firebase.json-Konfiguration mit optionaler apphosting.yaml für das Backend-Setup oder aktiviertes automatisiertes "git push to deploy" durch GitHub-Integration. Enthält Geheimnisverwaltung über CLI-Befehle für sicheren Zugriff auf sensible Schlüssel...
official