Skip to content
Firebase Auth Basics

Firebase Auth Basics Skill

Firebase's official skill for adding sign-in to an app: enable providers from firebase.json, deploy the auth config, wire up the client SDK on web, Flutter, Android or iOS, and lock data down with request.auth rules.

GitHub Docs
DevelopmentSecurity
Added to Onei AI
Apache-2.0

Install

Install with the skills CLI

One command for Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf and dozens of other agents. Needs Node.js; the skill is fetched straight from firebase/agent-skills.

$ npx skills add firebase/agent-skills --skill firebase-auth-basics

Run it in a terminal. The CLI finds the agents installed on your machine, asks which ones to add the skill to, and whether to install it into the folder you ran it from or for all your projects.

Other ways to install

Copy the whole skill folder — SKILL.md and any scripts or references beside it — into ~/.claude/skills/firebase-auth-basics/, where Claude Code picks it up in every project. Only git is needed.

tmp=$(mktemp -d) && \
  git clone --depth 1 --branch main https://github.com/firebase/agent-skills.git "$tmp" && \
  mkdir -p ~/.claude/skills && \
  cp -R "$tmp"/skills/firebase-auth-basics ~/.claude/skills/firebase-auth-basics

No scripts or references next to it? Saving the SKILL.md alone as ~/.claude/skills/firebase-auth-basics/SKILL.md works too.

Using another agent? Its personal skills folder
Codex
~/.agents/skills/
Cursor
~/.cursor/skills/
GitHub Copilot
~/.copilot/skills/
Gemini CLI
~/.gemini/skills/
Windsurf
~/.codeium/windsurf/skills/
OpenCode
~/.config/opencode/skills/

About

  • Enables Google Sign-In, email/password and anonymous auth from an auth block in firebase.json
  • Deploys the auth config with firebase deploy --only auth so OAuth clients get generated
  • Explains the localhost redirect-URI pitfall behind INVALID_AUTHORIZED_DOMAIN
  • Per-platform client references for web, Flutter, Android (Kotlin) and iOS (Swift)
  • Security-rules guidance for Firestore and Storage using request.auth

Firebase Auth Basics is the authentication skill from Firebase's official agent-skills collection, written for coding agents that need to add user sign-in to an app without guessing at console clicks. It covers the full path from an empty project to signed-in users whose data is protected by rules.

It starts with the model an agent needs to reason about: users identified by a uid that stays unique across providers, the supported identity providers (email and password, federated providers such as Google, GitHub, Microsoft and Apple, phone numbers, anonymous guest accounts that can later be linked, and custom auth), and the split between short-lived ID tokens and long-lived refresh tokens. Google Sign-In is recommended as the secure default.

Provisioning is where the skill is most specific. Google Sign-In, anonymous and email/password auth can be enabled from the CLI by adding an auth block to firebase.json, and the skill is emphatic that the configuration only takes effect after npx -y firebase-tools@latest deploy --only auth, which is also what generates the OAuth clients for each platform. It documents a common failure: putting a port number in authorizedRedirectUris (for example http://localhost:4000) makes the deploy fail with INVALID_AUTHORIZED_DOMAIN, while http://localhost works. Other providers are enabled in the Firebase Console.

Client setup is delegated to reference files for the web SDK, Flutter, Android (Kotlin) and iOS (Swift), and a security-rules reference shows how to use request.auth in Firestore and Storage rules. The skill assumes a Firebase project and a logged-in CLI, both covered by the companion firebase-basics skill. Apache-2.0.

SKILL.md

The instructions your agent loads, as published by Firebase.

SKILL.md
name
firebase-auth-basics
description
Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data access using auth rules.
compatibility
This skill is best used with the Firebase CLI, but does not require it. Firebase CLI can be accessed through `npx -y firebase-tools@latest`.
metadata
author: Google LLC category: Identity
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": "support@example.com",
        "authorizedRedirectUris": [
          "https://my-project-id.firebaseapp.com/__/auth/handler",
          "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, add http://localhost to
authorizedRedirectUris in firebase.json (or ensure localhost is included
in the Authorized Domains list in the Firebase Console under
Authentication > Settings > Authorized domains). CRITICAL: Do NOT include
the port number in authorizedRedirectUris (e.g., use http://localhost, NOT
http://localhost:9090 or http://localhost:4000), and do NOT include the
protocol or port number in the Console Authorized Domains list (use
localhost). Including a port number in authorizedRedirectUris causes
firebase deploy --only auth to fail with INVALID_AUTHORIZED_DOMAIN.

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

  1. Select your project.
  2. Enable the desired Sign-in providers (e.g., Email/Password, Google).
2. Client Setup & Usage

Web See [references/client_sdk_web.md](references/client_sdk_web.md).

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

iOS (Swift) See [references/ios_setup.md](references/ios_setup.md).

3. Security Rules

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

See [references/security_rules.md](references/security_rules.md).

Install

Google's official Firebase entry-point skill — CLI login, project creation and selection, and programmatic retrieval of google-services.json and GoogleService-Info.plist.

Featured

Auth0's official agent skill: a router that detects your framework and intent, then loads the right Auth0 guidance for login, MFA, Organizations, tenant audits, debugging or provider migration.

Browse all skills →