firebase-auth-basics

Настройка Firebase Authentication с несколькими поставщиками удостоверений и безопасным доступом к данным. Поддерживает email/пароль, номер телефона, анонимный вход, федеративных поставщиков (Google, Facebook, Twitter, GitHub, Microsoft, Apple) и интеграцию с пользовательской аутентификацией. Пользователи идентифицируются по уникальным UID с дополнительными свойствами, включая email, отображаемое имя, URL фотографии и статус подтверждения email. Аутентификация через CLI включает вход через Google, анонимную аутентификацию и email/пароль; другие поставщики требуют 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.

Больше skills от firebase

firebase-remote-config-basics
firebase
Всеобъемлющее руководство по Firebase Remote Config, включая управление шаблонами и использование SDK. Используйте этот навык, когда пользователю нужна помощь в настройке Remote Config, управлении функциональными флагами или динамическом обновлении поведения приложения.
officialdevelopmentapi
developing-genkit-dart
firebase
Унифицированный AI SDK для Dart, обеспечивающий генерацию кода, структурированные выходные данные, инструменты, потоки и агенты. Предоставляет основные API для генерации, определения инструментов, оркестрации потоков, эмбеддингов и стриминга через единый интерфейс. Включает 8+ плагинов для LLM-провайдеров (Google Gemini, Anthropic Claude, OpenAI GPT), Firebase AI, Model Context Protocol, интеграцию с браузером Chrome и хостинг HTTP-сервера через Shelf. Встроенный CLI с локальным UI для разработки, позволяющий выполнять потоки, трассировку, эксперименты с моделями и...
official
developing-genkit-go
firebase
Разрабатывайте AI-приложения с использованием Genkit на Go. Используйте, когда пользователь просит создать AI-функции, агентов, потоки или инструменты на Go с помощью Genkit, или при работе…
official
developing-genkit-js
firebase
We need to translate the given text from English to Russian, preserving the name "developing-genkit-js" if it appears, but it doesn't appear in the text. The text is a description of an agent skill. We must not add any extra commentary, labels, or formatting. Just the translation. The text: "Build AI-powered Node.js/TypeScript applications with Genkit flows, tools, and multi-model support. Genkit is provider-agnostic; supports Google AI, OpenAI, Anthropic, Ollama, and other LLM providers via plugins Define flows with type-safe schemas using Zod, execute generation requests, and compose multi-step AI workflows in TypeScript Requires Genkit CLI v1.29.0+; recent major API changes mean you must consult genkit docs:read and common-errors.md for current patterns, not prior knowledge..." We need to translate accurately, preserving technical terms like "Genkit", "Node.js", "TypeScript", "Zod", "CLI", "v1.29.0+", "docs:read",
official
developing-genkit-python
firebase
Разрабатывайте AI-приложения с помощью Genkit на Python. Используйте, когда пользователь спрашивает о Genkit, AI-агентах, потоках или инструментах на Python, или при столкновении с Genkit…
official
firebase-ai-logic
firebase
We need to translate the given English text into Russian, preserving the name "firebase-ai-logic" if it appears. The text does not contain the name, so we just translate the description. The instruction says: "Do not include the name unless it appears in the source text." It does not appear. So we translate the description. 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", "Gemini Nano", "Cloud Storage", "App Check", "JSON", "Chrome", "multimodal inference", "streaming", "on-device hybrid execution", etc. Also numbers:
official
firebase-ai-logic-basics
firebase
Официальный навык для интеграции Firebase AI Logic (Gemini API) в веб-приложения. Охватывает настройку, мультимодальный вывод, структурированный вывод и безопасность.
official
firebase-app-hosting-basics
firebase
Развёртывание и управление полнофункциональными веб-приложениями с помощью Firebase App Hosting с использованием Next.js, Angular и других поддерживаемых фреймворков. Требуется проект Firebase на тарифном плане Blaze; поддерживаются рабочие процессы серверного рендеринга (SSR) и инкрементальной статической регенерации (ISR). Развёртывание через конфигурацию firebase.json с опциональным файлом apphosting.yaml для настройки бэкенда или включение автоматического развёртывания через "git push" с интеграцией GitHub. Включает управление секретами через команды CLI для безопасного доступа к конфиденциальным ключам...
official