# Firebase on boxd

> Firebase Authentication client tools for project discovery, user sign-in and sign-up flows, out-of-band codes, and Secure Token refresh using a Firebase Web API Key.

- Page: https://boxd.sh/integrations/firebase/
- CLI: `run firebase` (8 commands)
- SDK: `import { firebase } from "@boxd/run"`; every parameter and response type is at `@boxd/run/firebase`
- Triggers: none
- Connect: `run auth firebase` (API key), or https://app.boxd.sh/integrations/detail/firebase
- All integrations: https://boxd.sh/integrations/ (Markdown: https://boxd.sh/integrations/index.md)

## From the shell

```sh
run auth firebase      # once: prints a link to connect your account
run firebase           # list its commands
run firebase get-auth-project-config
```

Parameters are flags (`--flag value`); object and array parameters take a JSON string. Output is YAML, or JSON with `--json`. Calls use your own connection; `--scope <name>` uses a connection shared with your team.

## From a script

```ts
import { every, firebase } from "@boxd/run";

every("1 hour", async () => {
  const result = await firebase.getAuthProjectConfig({});
  console.log(result);
});
```

Run it with `run firebase.run.ts`. Firebase has no triggers; `every()` polls on a schedule, keeps the script running as a job, and wakes the machine when it is due.

## Commands

Required flags are listed; `run firebase <command> --help` lists the optional ones. "common" marks what `run firebase` shows without `--all`.

| Command | SDK method | Required flags | Optional | Description |
|---|---|---|---|---|
| `discover-sign-in-methods` | `firebase.discoverSignInMethods()` | `--continue-uri` `--identifier` | 0 | Look up sign-in methods previously used by a Firebase account email |
| `get-auth-project-config` | `firebase.getAuthProjectConfig()` | — | 1 | Get the public Firebase Authentication configuration associated with the connected Web API key, including the project ID and authorized domains |
| `refresh-id-token` | `firebase.refreshIdToken()` | `--refresh-token` | 1 | Exchange a Firebase refresh token for a fresh Firebase ID token and rotated refresh token using Google's Secure Token service |
| `sign-in-with-custom-token` | `firebase.signInWithCustomToken()` | `--custom-token` | 0 | Exchange a trusted server-minted Firebase custom token for a Firebase ID token and refresh token |
| `sign-in-with-email-link` | `firebase.signInWithEmailLink()` | `--email` `--oob-code` | 0 | Complete Firebase email-link sign-in using an email address and the one-time OOB code from a previously delivered sign-in link |
| `sign-in-with-idp` | `firebase.signInWithIdp()` | `--provider-id` `--provider-parameters` `--request-uri` | 1 | Sign in with one configured external identity provider using provider-specific OAuth or OIDC credential parameters |
| `sign-in-with-password` | `firebase.signInWithPassword()` | `--email` `--password` | 0 | Sign in an existing Firebase Authentication user with email and password and return fresh ID and refresh tokens |
| `verify-password-reset-code` | `firebase.verifyPasswordResetCode()` | `--oob-code` | 0 | Validate a Firebase password-reset OOB code and identify the associated email and request type without changing the password |

## Docs

- [run CLI](https://docs.boxd.sh/cli/run): Call connected integrations from the shell, connect new ones, and run automations.
- [Quickstart](https://docs.boxd.sh/guides/integrations/quickstart): Connect an integration, call it from the shell, and turn a script into an automation.
- [Connections](https://docs.boxd.sh/guides/integrations/connections): Connect an account once, for yourself or for your whole organization.
- [Scripts](https://docs.boxd.sh/guides/automations/scripts): Typed integrations, triggers, schedules and state in a .run.ts file.
- [Jobs](https://docs.boxd.sh/guides/automations/jobs): How a script becomes a background job: states, retries, sleep and wake.
- [Beyond the catalog](https://docs.boxd.sh/guides/automations/beyond-the-catalog): Reach your own APIs, databases and cloud accounts from a script.
