firebase-auth-basics

Set up Firebase Authentication with multiple identity providers and secure data access. Supports email/password, phone number, anonymous, federated providers (Google, Facebook, Twitter, GitHub, Microsoft, Apple), and custom auth integration Users are identified by unique UIDs with optional properties including email, display name, photo URL, and email verification status Authentication via CLI enables Google Sign In, anonymous auth, and email/password; other providers require 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.

Mais skills de firebase

firebase-remote-config-basics
firebase
Guia abrangente para o Firebase Remote Config, incluindo gerenciamento de templates e uso do SDK. Use esta habilidade quando o usuário precisar de ajuda para configurar o Remote Config, gerenciar feature flags ou atualizar o comportamento do aplicativo dinamicamente.
officialdevelopmentapi
developing-genkit-dart
firebase
SDK de IA unificado para Dart que permite geração de código, saídas estruturadas, ferramentas, fluxos e agentes. Fornece APIs principais para geração, definição de ferramentas, orquestração de fluxos, embeddings e streaming com uma única interface. Inclui mais de 8 plugins para provedores de LLM (Google Gemini, Anthropic Claude, OpenAI GPT), Firebase AI, Model Context Protocol, integração com navegador Chrome e hospedagem de servidor HTTP via Shelf. CLI integrado com interface de desenvolvimento local para execução de fluxos, rastreamento, experimentação de modelos e...
official
developing-genkit-go
firebase
Desenvolva aplicações com tecnologia de IA usando Genkit em Go. Use quando o usuário pedir para construir funcionalidades de IA, agentes, fluxos ou ferramentas em Go usando Genkit, ou ao trabalhar…
official
developing-genkit-js
firebase
Crie aplicativos Node.js/TypeScript com tecnologia de IA usando flows, ferramentas e suporte a múltiplos modelos do Genkit. O Genkit é independente de provedor; suporta Google AI, OpenAI, Anthropic, Ollama e outros provedores de LLM por meio de plugins. Defina flows com esquemas type-safe usando Zod, execute solicitações de geração e componha workflows de IA de várias etapas em TypeScript. Requer Genkit CLI v1.29.0+; mudanças recentes na API significam que você deve consultar genkit docs:read e common-errors.md para padrões atuais, e não conhecimento prévio...
official
developing-genkit-python
firebase
Desenvolva aplicações com tecnologia de IA usando Genkit em Python. Use quando o usuário perguntar sobre Genkit, agentes de IA, fluxos ou ferramentas em Python, ou ao encontrar Genkit…
official
firebase-ai-logic
firebase
We need to translate the given text from English to Brazilian Portuguese. The text describes a client-side Gemini integration for web apps. We must preserve the name "firebase-ai-logic" but it's not in the text, so we ignore. We must not add any labels or extra commentary. Just translate the text. The text: "Client-side Gemini integration for web apps with multimodal inference, streaming, and on-device hybrid execution. Supports text-only and multimodal inputs (images, audio, video, PDFs); files over 20 MB route through Cloud Storage Includes chat sessions with automatic history, streaming responses for real-time display, and structured JSON output enforcement Offers hybrid on-device inference via Gemini Nano in Chrome, with automatic fallback to cloud execution Requires App Check for production..." We need to translate accurately, preserving technical terms like "Gemini", "Cloud Storage", "Gemini Nano", "Chrome", "App Check", "JSON", "MB". Also "multimodal inference", "streaming", "on-device hybrid execution", etc. Let's translate:
official
firebase-ai-logic-basics
firebase
Habilidade oficial para integrar o Firebase AI Logic (API Gemini) em aplicações web. Aborda configuração, inferência multimodal, saída estruturada e segurança.
official
firebase-app-hosting-basics
firebase
We need to translate the given text from English to Brazilian Portuguese. The text describes a skill for deploying and managing web apps with Firebase App Hosting. We must preserve product names, protocol names, URLs, numbers, technical terms. The name "firebase-app-hosting-basics" is not in the text, so we don't include it. We translate only the text inside <text>. No extra commentary. Let's translate: "Deploy and manage full-stack web apps with Firebase App Hosting using Next.js, Angular, and other supported frameworks." -> "Implante e gerencie aplicativos web full-stack com o Firebase App Hosting usando Next.js, Angular e outros frameworks compatíveis." "Requires Firebase project on Blaze pricing plan; supports Server-Side Rendering (SSR) and Incremental Static Regeneration (ISR) workflows" -> "Requer projeto Firebase no plano de preços Blaze; suporta fluxos de trabalho de Renderização no Servidor (SSR) e Regeneração Estática Incremental (ISR
official