> ## Documentation Index
> Fetch the complete documentation index at: https://funnelfox.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Firebase authentication

> Set up Firebase Authentication in FunnelFox. Enable email, social login, and anonymous auth for your web funnel users.

The [Firebase integration](https://app.funnelfox.com/integrations/firebase) enables multiple authentication methods while maintaining a consistent user identity.

## How it works

FunnelFox authenticates users directly within your funnels, giving each user a stable Firebase UID (FUID). It will either:

* **Create a new Firebase user (sign up)**: If no user exists for the customer's credentials.
* **Authenticate an existing Firebase user (sign in)**: If the user was created during a previous funnel experience and signs in using an OAuth button or by entering their email. New purchase is recorded in the existing Adapty or RevenueCat profile.

Once the user is authenticated, your app takes over the in-app authentication flow.

The email entered by the customer (via Email input or OAuth) is saved as the `{{email}}` funnel variable. You can use it in upstream screens, for example, in deep links.

### Email & Password authentication

Email-based authentication occurs when the customer navigates from the authentication screen with email/password inputs filled out.

**Sign up:**

When a customer submits their credentials in a funnel, FunnelFox automatically handles Firebase user creation:

* FunnelFox creates a Firebase user via Email/Password authentication.
* By default, a secure random password is generated for the user.
* If the same screen includes a Password input element, that value replaces the generated password.

<Tip>For the Email/Password sign up, we recommend using the Password input element. If you rely on the generated random password, it won’t be accessible to the user, so you’ll need to implement a [password reset flow](https://firebase.google.com/docs/auth/admin/email-action-links) during the in-app authentication step. </Tip>

**Sign in:**

Email-based sign in works through the same Email input, but requires the [Service account key](#service-account-key) to be uploaded to FunnelFox.

When a customer enters their email, FunnelFox checks whether a Firebase user already exists for that address:

* If a Firebase user exists, FunnelFox recognizes the customer as returning, signs them in using their Firebase UID (FUID), and fires the [profile.updated](/api-reference/webhook-reference/profileupdated) webhook.
* If no Firebase user exists, FunnelFox treats the customer as new and creates a Firebase user (sign up).

<Warning>FunnelFox doesn't check the password during sign in. It only verifies whether the email already belongs to a Firebase user.</Warning>

To find the customer, FunnelFox first checks its own records for a profile that already stores an FUID. If none is found, FunnelFox requires the [Service account key](#service-account-key) to look the customer up directly in Firebase. The new purchase is then recorded in the existing Adapty or RevenueCat profile linked to that FUID.

### OAuth authentication

Unlike email/password authentication, OAuth works right when the customer uses the OAuth button.

OAuth providers enable seamless social authentication within your funnels:

* Enable OAuth providers (e.g., Google or Apple) in Firebase and add OAuth buttons in the Editor.
* Users receive a secure and seamless authentication experience:
  * If it’s the user’s first time, Firebase creates the account.
  * If the account already exists, Firebase signs them in using the same OAuth buttons and FunnelFox fires the [profile.updated](/api-reference/webhook-reference/profileupdated) webhook.

FunnelFox automatically tracks OAuth button interactions. When a customer
taps an OAuth button, FunnelFox sends an `auth_button_clicked` event,
followed by `auth_success` or `auth_fail` depending on the result. Learn more in the
[events reference](/integrations/events).

### Unified identity (FUID)

Firebase UID becomes the canonical identifier across all integrated services:

* The user's Firebase UID (FUID) serves as their primary identifier.
* When other integrations are enabled, FunnelFox forwards this ID automatically:
  * [Adapty](/integrations/subscription-management/adapty) receives it as CustomerUserID.
  * [RevenueCat](/integrations/subscription-management/revenuecat) receives it as appUserID.

If a customer makes a purchase while signed in within the funnel, the new purchase is recorded in the existing Adapty or RevenueCat profile.

## Setup

Complete the Firebase integration by creating a Firebase project, configuring authentication methods, and connecting it to FunnelFox.

### 1. Create Firebase Project

Start by setting up a new Firebase project in the [Firebase console](https://console.firebase.google.com/).

1. Go to the Firebase console and start creating a new Firebase project.
2. Name your project.
3. Configure Google Analytics.
4. Click **Create project**.

### 2. Configure Firebase Authentication

Enable Firebase Authentication to configure your preferred sign-in methods.

1. In your Firebase project, go to **Build > Authentication**.

<Frame>
  <img src="https://mintcdn.com/funnelfox/Nggd7btibyPuEAU_/assets/firebase-build.png?fit=max&auto=format&n=Nggd7btibyPuEAU_&q=85&s=22de6b8feff01d309743d7844073d6aa" alt="Authentication" width="1639" height="827" data-path="assets/firebase-build.png" />
</Frame>

2. Click **Get started**.

Follow the steps below to set up your sign-in methods.

### 3. Configure sign-in methods

Select a provider to configure under the **Sign-in method** in Firebase.

Once done, click **Add new provider** to set up another one.

<Tabs>
  <Tab title="Email/Password">
    The Email/Password method allows users to sign up using their email address and password.

    1. Click **Email/Password** in the **Native providers**.
    2. Toggle on **Email/Password**.
    3. Click **Save**.

    <Frame>
      <img src="https://mintcdn.com/funnelfox/_9jmOZHt8c-XeasZ/assets/email-setup.png?fit=max&auto=format&n=_9jmOZHt8c-XeasZ&q=85&s=3bc6c197da9a1754ec0246730b1784be" alt="Email/Password" width="1179" height="533" data-path="assets/email-setup.png" />
    </Frame>
  </Tab>

  <Tab title="Google OAuth">
    Google OAuth provides seamless authentication using Google accounts. You'll first configure the provider in Firebase, then set up your Google Cloud console.

    **Firebase configuration**

    1. Click **Google** in **Additional providers**.
    2. Toggle on **Google**.
    3. Enter your project details:
       * **Public-facing name**: Displayed on emails that your users receive after creating an account with your app.
       * **Support email**: Presented to users when they are authenticating with Google.
    4. Click **Save**.

    <Frame>
      <img src="https://mintcdn.com/funnelfox/TmrMcoRKCU2cAbzF/assets/google-setup.png?fit=max&auto=format&n=TmrMcoRKCU2cAbzF&q=85&s=bdbde74aa9a141a4a11c3b0fc07c6351" alt="Google OAuth" width="1164" height="812" data-path="assets/google-setup.png" />
    </Frame>

    5. Go to **Authentication > Settings > Authorized domains** and make sure the following domains are added:

    * Your full project URL.
    * `https://app.funnelfox.com`
    * Your custom domains (if any).

          <Frame>
            <img src="https://mintcdn.com/funnelfox/6on5Q4GhJWcj-egQ/assets/firebase-authorized-domains.png?fit=max&auto=format&n=6on5Q4GhJWcj-egQ&q=85&s=5b3872fc66069624ab4c5cde503aa5cf" width="1920" height="879" data-path="assets/firebase-authorized-domains.png" />
          </Frame>

    **Google console configuration**

    Configure Google Cloud console to enable OAuth authentication with your FunnelFox domain.

    <Info>You will need your full project URL for this step. Go to [Settings > Domains](https://app.funnelfox.com/settings/domains) in your FunnelFox project and copy your project URL, e.g. `https://demo-app.fnlfx.com`.</Info>

    1. Open the project you've just created in the [Google Cloud console](https://console.cloud.google.com/).

    <Frame>
      <img src="https://mintcdn.com/funnelfox/_9jmOZHt8c-XeasZ/assets/cloud-console.png?fit=max&auto=format&n=_9jmOZHt8c-XeasZ&q=85&s=087a498a1660dc694120b84f00d7a93e" alt="Cloud-console" width="1920" height="879" data-path="assets/cloud-console.png" />
    </Frame>

    2. Go to **APIs & Services > Credentials** from the **Quick access** section.

    <Frame>
      <img src="https://mintcdn.com/funnelfox/_9jmOZHt8c-XeasZ/assets/api-services.gif?s=c55ca1e041ce38754f5a4a247ab2123d" alt="Api-services" width="1656" height="802" data-path="assets/api-services.gif" />
    </Frame>

    3. Open the web client just auto created by Google Service under **OAuth 2.0 Client IDs**.

    <Frame>
      <img src="https://mintcdn.com/funnelfox/Nggd7btibyPuEAU_/assets/web-client.png?fit=max&auto=format&n=Nggd7btibyPuEAU_&q=85&s=c7d8a613343ba259e1d3cbabf4fb008d" alt="Web client" width="1558" height="801" data-path="assets/web-client.png" />
    </Frame>

    4. Click **Add URL** twice under **Authorized JavaScript origins**, and set up the following two fields:
       * Paste your full project URL.
       * Paste `https://app.funnelfox.com`.

    <Frame>
      <img src="https://mintcdn.com/funnelfox/0pzxPSifplVcrwL9/assets/add-project-url.png?fit=max&auto=format&n=0pzxPSifplVcrwL9&q=85&s=dfda3018b214e36f5002372137a16114" alt="Project url" width="1920" height="879" data-path="assets/add-project-url.png" />
    </Frame>

    5. Click **Add URl** twice under **Authorized redirect URIs**, and set up the following two fields:
       * Paste your full project URL+ `/__/auth/handler`. Your final URl will look like `https://demo-app.fnlfx.com/__/auth/handler`.
       * Paste `https://app.funnelfox.com/__/auth/handler`.

    <Frame>
      <img src="https://mintcdn.com/funnelfox/XYWX2neK48GjB2np/assets/final-url.png?fit=max&auto=format&n=XYWX2neK48GjB2np&q=85&s=b64bdf09da6ef7d60ffbde7817175801" alt="Redirect url" width="1920" height="879" data-path="assets/final-url.png" />
    </Frame>

    6. Click **Save**.
  </Tab>

  <Tab title="Apple OAuth">
    Apple OAuth provides seamless authentication using Apple ID. You'll configure your Service ID and key in Apple Developer Portal, then set up the provider in Firebase.

    <Info>You will need an **App ID** registered with enabled **Sign in with Apple** capability. Learn about [App IDs in Apple documentation](https://developer.apple.com/help/account/identifiers/register-an-app-id) if you don't have one.</Info>

    **Apple Service ID configuration**

    1. Go to [Certificates, Identifiers & Profiles > Identifiers](https://developer.apple.com/account/resources/identifiers) in your Apple Developer Portal.

    2. Click **+** to create a new identifier.

           <Frame>
             <img src="https://mintcdn.com/funnelfox/mlvS9z__U8OurXty/assets/add-identifier.png?fit=max&auto=format&n=mlvS9z__U8OurXty&q=85&s=5597fe3cfd454a14a413351cd45067ca" width="1257" height="518" data-path="assets/add-identifier.png" />
           </Frame>

    3. Select **Services IDs** and click **Continue**.

           <Frame>
             <img src="https://mintcdn.com/funnelfox/1m79HrOn0fNLyjf5/assets/services-ids.png?fit=max&auto=format&n=1m79HrOn0fNLyjf5&q=85&s=1cf311d9ee015953d0733db9d5f45c60" width="1249" height="701" data-path="assets/services-ids.png" />
           </Frame>

    4. Enter your Service ID **Description** and **Identifier**. Use reverse-domain naming, e.g. `com.yourdomain.oauth`.

           <Frame>
             <img src="https://mintcdn.com/funnelfox/1m79HrOn0fNLyjf5/assets/service-id-details.png?fit=max&auto=format&n=1m79HrOn0fNLyjf5&q=85&s=1a980d93ae2e20405af985ff7ad49959" width="1257" height="403" data-path="assets/service-id-details.png" />
           </Frame>

    5. Click **Continue**, then **Register**.

    6. Open the Service ID you just created.

    7. Enable **Sign In with Apple** and click **Configure**.

           <Frame>
             <img src="https://mintcdn.com/funnelfox/mlvS9z__U8OurXty/assets/checkmark-signin-apple.png?fit=max&auto=format&n=mlvS9z__U8OurXty&q=85&s=b11c40014027ee43d15c376386d754d5" width="1257" height="517" data-path="assets/checkmark-signin-apple.png" />
           </Frame>

    8. Configure the Web Authentication:

       * **Primary App ID**: Select your App ID.
       * **Domains and Subdomains**: Add two domains
         * Your project domain from [Settings > Domains](/dashboard/settings#domains) in FunnelFox, e.g. `demo-app.fnlfx.com`.
         * `https://app.funnelfox.com`.
       * **Return URLs**: Add two return domains
         * Your project domain with the auth handler path: `https://YOUR_DOMAIN/__/auth/handler`. For example, `https://demo-app.fnlfx.com/__/auth/handler`.
         * `https://app.funnelfox.com/__/auth/handler`.

           <Frame>
             <img src="https://mintcdn.com/funnelfox/M8vAy7IXyE_xdO8W/assets/web-authentication-config.png?fit=max&auto=format&n=M8vAy7IXyE_xdO8W&q=85&s=2b5a6c174e1518ddf8e860723c3ca730" width="1281" height="825" data-path="assets/web-authentication-config.png" />
           </Frame>

    9. Click **Next**, then click **Done**.

    10. Click **Continue**, then click **Save** to the right from **Services ID Configuration**.

    **Apple key configuration**

    1. Go to the **Keys** tab in [Certificates, Identifiers & Profiles](https://developer.apple.com/account/resources/identifiers).

    2. Click **+** to create a new key.

           <Frame>
             <img src="https://mintcdn.com/funnelfox/mlvS9z__U8OurXty/assets/add-key.png?fit=max&auto=format&n=mlvS9z__U8OurXty&q=85&s=a9d37f78de70f3fe36417204e82211b5" width="1260" height="457" data-path="assets/add-key.png" />
           </Frame>

    3. Name your key.

    4. Enable **Sign in with Apple** and click **Configure**.

           <Frame>
             <img src="https://mintcdn.com/funnelfox/mlvS9z__U8OurXty/assets/configure-key.png?fit=max&auto=format&n=mlvS9z__U8OurXty&q=85&s=b6f427e45b039dc7627004fd4e6c194c" width="1306" height="860" data-path="assets/configure-key.png" />
           </Frame>

    5. Select your **Primary App ID** and click **Save**.

           <Frame>
             <img src="https://mintcdn.com/funnelfox/fE-ClzZI29xgbnLX/assets/key-primary-addid.png?fit=max&auto=format&n=fE-ClzZI29xgbnLX&q=85&s=4d7f3a8e60851bf6ee962ebb45d1cb55" width="1249" height="443" data-path="assets/key-primary-addid.png" />
           </Frame>

    6. Click **Continue**, then click **Register**.

    7. Click **Download** to save your key file. You'll need it in the next step.

       <Warning>You can download the key file only once.</Warning>

           <Frame>
             <img src="https://mintcdn.com/funnelfox/fE-ClzZI29xgbnLX/assets/key-download.png?fit=max&auto=format&n=fE-ClzZI29xgbnLX&q=85&s=8ddec381c51295a3817d8053f910d879" width="1251" height="544" data-path="assets/key-download.png" />
           </Frame>

    **Firebase configuration**

    1. Go to **Authentication > Sign-in method** in your Firebase project.

    2. Click **Add new provider**.

    3. Click **Apple** in **Additional providers**.

    4. Toggle on **Apple**.

    5. Enter your project details:

       * **Services ID**: The identifier for the Service ID you created.
       * **Apple team ID**: Your 10-character team ID from the **Membership details** page of your [Apple developer account](https://developer.apple.com/account). Learn more about [Apple Team ID](https://developer.apple.com/help/glossary/team-id/).
       * **Key ID**: The identifier of the key you created.
       * **Private key**: The contents of the key file you downloaded.

           <Frame>
             <img src="https://mintcdn.com/funnelfox/mlvS9z__U8OurXty/assets/apple-sign-in-details.png?fit=max&auto=format&n=mlvS9z__U8OurXty&q=85&s=ea2dc91edc347752b821199957e78f43" width="1654" height="971" data-path="assets/apple-sign-in-details.png" />
           </Frame>

    6. Click **Save**.

    7. Go to **Authentication > Settings > Authorized domains** and make sure the following domains are added:

       * Your full project URL.
       * `https://app.funnelfox.com`
       * Your custom domains (if any).

           <Frame>
             <img src="https://mintcdn.com/funnelfox/6on5Q4GhJWcj-egQ/assets/firebase-authorized-domains.png?fit=max&auto=format&n=6on5Q4GhJWcj-egQ&q=85&s=5b3872fc66069624ab4c5cde503aa5cf" width="1920" height="879" data-path="assets/firebase-authorized-domains.png" />
           </Frame>
  </Tab>

  <Tab title="Magic link">
    Magic links eliminate password-related routine and are very reliable. Users enter their email, receive a link, and tapping it logs them in.

    Learn how to [configure magic links](https://firebase.google.com/docs/auth/web/email-link-auth) in Firebase.
  </Tab>
</Tabs>

### 4. Register Your App in Firebase

Register your web app in Firebase to obtain the configuration values needed for FunnelFox integration.

1. Go back to your Firebase project.
2. Click the settings gear icon at the top left and select **Project settings**.

<Frame>
  <img src="https://mintcdn.com/funnelfox/Nggd7btibyPuEAU_/assets/project-settings.png?fit=max&auto=format&n=Nggd7btibyPuEAU_&q=85&s=f0dbdf8921bb48be0451182de496c2d5" alt="Project settings" width="1139" height="744" data-path="assets/project-settings.png" />
</Frame>

3. Select the web icon under **Your apps**.

<Frame>
  <img src="https://mintcdn.com/funnelfox/Nggd7btibyPuEAU_/assets/your-apps.png?fit=max&auto=format&n=Nggd7btibyPuEAU_&q=85&s=488024a4458531a72c106e5a7d161960" alt="Web app" width="1920" height="879" data-path="assets/your-apps.png" />
</Frame>

4. Add your **app nickname**.
5. Click **Register app**.

You will see the config required for the next step.

<Frame>
  <img src="https://mintcdn.com/funnelfox/Nggd7btibyPuEAU_/assets/final-config.png?fit=max&auto=format&n=Nggd7btibyPuEAU_&q=85&s=86cd2ace3f39b07d9daae4580f44c051" alt="Config" width="1920" height="879" data-path="assets/final-config.png" />
</Frame>

### 5. Connect Firebase to FunnelFox

Complete the integration by adding your Firebase configuration to FunnelFox.

1. Go to [Integrations > Firebase](https://app.funnelfox.com/integrations/firebase) in FunnelFox.
2. Toggle on **Firebase**.
3. Copy the config values from Firebase project and paste them in FunnelFox using the following mapping:

| Firebase Config Value | FunnelFox Field      |
| --------------------- | -------------------- |
| `apiKey`              | Firebase API Key     |
| `authDomain`          | Firebase Auth Domain |
| `projectId`           | Firebase Project ID  |

4. Click **Save changes**.

<Frame>
  <img src="https://mintcdn.com/funnelfox/lX27qkgxCbgzx_GN/assets/config-copied.png?fit=max&auto=format&n=lX27qkgxCbgzx_GN&q=85&s=5c9a71a255aea533a20598de52876a24" alt="Config copied" width="1920" height="879" data-path="assets/config-copied.png" />
</Frame>

<Check>You successfully integrated Firebase! Add the authentication methods you've set up to your funnels in the Editor.</Check>

## Service account key

The service account key lets FunnelFox look customers up in Firebase. It's required for email sign in to work reliably.

With the key, FunnelFox can find a customer in Firebase even when:

* The customer exists in FunnelFox with an email only, and no FUID is stored in their profile.
* The customer exists in Firebase but not yet in this FunnelFox project.

To upload the key to FunnelFox:

<Steps>
  <Step title="Generate a private key in Firebase">
    1. Go to **Settings > Service accounts** in the [Firebase console](https://console.firebase.google.com/).

    <Frame>
      <img src="https://mintcdn.com/funnelfox/2pncgk39KonE-Ibc/assets/firebase-service-accounts.png?fit=max&auto=format&n=2pncgk39KonE-Ibc&q=85&s=51a5482c18f3b4dfa92967d8e518e33f" width="1920" height="989" data-path="assets/firebase-service-accounts.png" />
    </Frame>

    2. Click **Generate new private key**.

    <Frame>
      <img src="https://mintcdn.com/funnelfox/2pncgk39KonE-Ibc/assets/firebase-generate-key.png?fit=max&auto=format&n=2pncgk39KonE-Ibc&q=85&s=dd7bd6b225bb664fe91ce68ce5ccf2e1" width="1920" height="989" data-path="assets/firebase-generate-key.png" />
    </Frame>

    3. Confirm the download. The JSON file with the key is created and downloaded within a few seconds.
  </Step>

  <Step title="Upload the key to FunnelFox">
    Go to [Integrations > Firebase](https://app.funnelfox.com/integrations/firebase) in FunnelFox. Upload the JSON file using the **Service Account Key** field, then save changes.

    <Frame>
      <img src="https://mintcdn.com/funnelfox/CUIasovNB1ICa7Ml/assets/firebase-upload-key.png?fit=max&auto=format&n=CUIasovNB1ICa7Ml&q=85&s=d9d3e79ca68d53784ffff598dd873b62" width="1920" height="989" data-path="assets/firebase-upload-key.png" />
    </Frame>
  </Step>
</Steps>

### Multi-project setups

If you run multiple FunnelFox projects integrated with the same Firebase project, the service account key lets a customer use email sign in even when they were originally created in a different FunnelFox project.

In this case, FunnelFox:

1. Looks the customer up in Firebase.
2. Creates a new profile in the current project, since the customer didn't exist here before.
3. Signs in the same Firebase customer by FUID.
4. Records the purchase in the same Adapty or RevenueCat profile.

<Info>Both FunnelFox projects must be integrated with the same Firebase project for this to work.</Info>

## Add authentication to funnels

Once Firebase is configured, you can add authentication flows to your funnels in the Editor. The following authentication methods correspond to the ones you've set up in Firebase.

The same OAuth buttons serve both authentication methods: sign up and sign in.

### Email/Password authentication

Enable users to authenticate with their email address and custom password.

To add Email/Password authentication to your funnel:

1. In the Editor, prompt the AI Chat to add a screen for user registration with both **Email** and **Password** inputs.

   Or go to **Add element > Inputs** and add these inputs manually.

2. Set the Custom ID to `firebase-password` for the Password input.

<Note>By default, FunnelFox generates a random password when a user submits their email in the funnel. It's important to add the Password input on the same screen to replace the previously generated password with the one provided.</Note>

<Frame>
  <img src="https://mintcdn.com/funnelfox/cxG6YKcN6wJiSnp-/assets/firebase-password.png?fit=max&auto=format&n=cxG6YKcN6wJiSnp-&q=85&s=f5c5ee16428fb2b5998720ad833163ea" alt="Password ID" width="1163" height="909" data-path="assets/firebase-password.png" />
</Frame>

### OAuth authentication

Enable seamless OAuth authentication using Google or Apple accounts for a frictionless user experience.

To add OAuth authentication to your funnel:

1. In the Editor, prompt the AI Chat to add a screen for user registration with OAuth button or use the one you've already added for Email/Password.

   Or click **Add element > Authentication** and select **OAuth button**.

2. Go to the **Parameters** tab of the OAuth button.

3. Select OAuth provider.

4. Under **Actions**, set up user navigation for cases when authentication succeeds or fails.

Learn more about setting up [navigation actions](/editor/actions#navigate).

<Warning>Apple OAuth works correctly only in a published funnel and returns a 403 error in funnel preview.</Warning>

<Frame>
  <img src="https://mintcdn.com/funnelfox/WZP3rcM4GPeTYDRJ/assets/google-oauth.png?fit=max&auto=format&n=WZP3rcM4GPeTYDRJ&q=85&s=666ebe2ef90bba17925870acf76b97b1" width="1165" height="964" data-path="assets/google-oauth.png" />
</Frame>
