Firebase Integration with SmythOS
Need to manage users for your application? Connect Firebase Authentication to SmythOS and empower your agents to handle user creation, sign-in, and data retrieval programmatically.
List of Firebase Components
Quickly compare Firebase Authentication components by what they do and their key I/O. Click any component name to jump directly to its detailed guide.
| Component | Action | What it Does | Inputs | Key Outputs | Use Case |
|---|---|---|---|---|---|
| Create User | Write | Creates a new user with an email and password. | required email, password | idToken, localId | Handling new user sign-ups. |
| Sign In With Email & Password | Auth | Authenticates a user and returns an ID token. | required email, password | idToken, localId | Logging users into your application. |
| Get User Data | Read | Retrieves the profile information of an authenticated user. | required idToken | users | Fetching user details after they sign in. |
Prerequisites
Before you begin, please ensure you have the following:
- An active SmythOS account. (Sign up here).
- A Google Firebase Project.
- Email/Password Sign-In enabled in your Firebase Authentication settings.
- Your Firebase project's Web API Key.
Getting Started With Firebase
The connection between SmythOS and Firebase Authentication is configured using your project's Web API Key.
Step 1: Get Your Firebase Web API Key
- Navigate to the Firebase Console and select your project.
- In the project sidebar, click the Settings gear and select Project settings.
- Under the General tab, scroll down to the "Your apps" card.
- If you don't have a web app, create one by clicking the
</>icon. - In your web app's configuration details, you will find the
apiKey. Copy this value.
Step 2: Store Your API Key in SmythOS Vault
Your API Key is a sensitive credential. Use the SmythOS Vault to store it securely.
- In your SmythOS dashboard, navigate to the Vault.
- Create a new secret and paste your Firebase Web API Key as the value. Give it a memorable name, like
firebase_web_api_key. - For more details, see the Vault Documentation.
Step 3: Configure a Firebase Component
- In your SmythOS agent graph, drag and drop any Firebase component.
- Click the component to open its Settings panel.
- In the
API Keyfield, select the secret you saved in the Vault (e.g.,firebase_web_api_key). - Your connection is now configured for that component.
Which Firebase Component Should I Use?
| If you need to… | Workflow | Use this Component | Why this one? |
|---|---|---|---|
| Register a new user for your app | User Sign-up | Create User | This is the dedicated endpoint for creating a new account with email and password. |
| Log an existing user in | User Sign-in | Sign In With Email & Password | This component authenticates a user's credentials and returns a session idToken. |
| Get details for the current user (e.g., after they log in) | Fetching Profile | Get User Data | This takes the idToken from a sign-in event to securely retrieve that user's information. |
Component Details
This section provides detailed information for each Firebase component.
Create User
Creates a new user account in your Firebase project using an email and password.
Inputs
| Field | Type | Required | Notes |
|---|---|---|---|
email | string | Yes | The user's email address. Must be a valid email format. |
password | string | Yes | The user's password. Must be at least six characters long. |
Outputs
| Field | Type | Description |
|---|---|---|
idToken | string | A Firebase ID token for the newly created user's session. |
localId | string | The unique user ID (UID) assigned to the new user. |
Response | object | The full, raw JSON response from the Firebase Auth API. |
Headers | object | The HTTP headers from the API response. |
{
"component": "firebase.createUser",
"email": "[email protected]",
"password": "strongPassword123"
}
Sign In With Email & Password
Signs in an existing user with their email and password and returns an ID token for their session. (Formerly "ID Token").
Inputs
| Field | Type | Required | Notes |
|---|---|---|---|
email | string | Yes | The email address of the existing user. |
password | string | Yes | The password for the user's account. |
Outputs
| Field | Type | Description |
|---|---|---|
idToken | string | A Firebase ID token for the authenticated user's session. This is required for other authenticated requests. |
localId | string | The unique user ID (UID) of the signed-in user. |
Response | object | The full, raw JSON response from the Firebase Auth API. |
Headers | object | The HTTP headers from the API response. |
{
"component": "firebase.idToken",
"email": "[email protected]",
"password": "userPassword123"
}
Get User Data
Retrieves the profile information for an authenticated user, using their session ID token.
Inputs
| Field | Type | Required | Notes |
|---|---|---|---|
idToken | string | Yes | The Firebase ID token obtained from a successful sign-in. |
Outputs
| Field | Type | Description |
|---|---|---|
users | array | An array containing a single user object with their profile information (UID, email, creation date, etc.). |
Response | object | The full, raw JSON response from the Firebase Auth API. |
Headers | object | The HTTP headers from the API response. |
{
"component": "firebase.getUserData",
"idToken": "id-token-from-previous-step"
}
Best Practices & Advanced Tips
- Secure Your API Key: Always store your Firebase Web API key in the SmythOS
Vault. While it is a public key, keeping it in the Vault makes management easier. - Understand the Auth Flow: The typical flow is
Create Userfor new users, followed bySign Into get anidToken, and thenGet User Datausing that token. For returning users, the flow starts withSign In. - Handle Tokens Securely: The
idTokenproves a user is signed in. Never expose it to untrusted environments. It should be managed within your agent's workflow to make secure requests. - Use Firebase Security Rules: While this integration manages users, remember to configure Firebase Security Rules for services like Firestore and Cloud Storage to control what data each authenticated user can access.
Troubleshooting Common Issues
-
Error:
EMAIL_EXISTS- Cause: Attempting to create a user with an email address that is already registered in your Firebase project.
- Solution: This is expected behavior. Your agent's logic should handle this by informing the user that the email is already in use, perhaps suggesting they sign in instead.
-
Error:
INVALID_PASSWORDorEMAIL_NOT_FOUND- Cause: The email/password combination provided to the "Sign In" component is incorrect.
- Solution: This is a standard failed login attempt. Your agent should return a generic "Invalid credentials" message to the user.
-
Error:
TOKEN_EXPIRED- Cause: The
idTokenused in the "Get User Data" component has expired (they typically last for one hour). - Solution: Your application needs a mechanism to refresh the ID token using the refresh token provided upon sign-in. This is a more advanced flow that may require calling the Firebase token refresh endpoint.
- Cause: The
-
Error:
API_KEY_NOT_VALID- Cause: The Web API Key configured in the component's settings is incorrect.
- Solution: Go to your Firebase Project Settings, copy the correct
apiKey, and update the secret in your SmythOS Vault.
What's Next?
You are now ready to build applications with secure user management using the SmythOS Firebase Integration!
Consider these ideas:
-
Build an Agent That...
- Manages a complete user lifecycle. A user signs up via a form, the agent calls
Create User, then logs the newlocalIdinto a separate database (like Firestore or a SQL database) to store additional profile information. - Acts as a backend for a simple web app. The frontend collects login details, sends them to the agent, which uses
Sign Into authenticate, and then uses theidTokento securely fetch and return user-specific data. - Connects to other services. After a user signs up with Firebase, the agent could also create a corresponding customer profile in a CRM like HubSpot.
- Manages a complete user lifecycle. A user signs up via a form, the agent calls
-
Explore Other Integrations:
- Combine Firebase Auth with a database integration like Firestore (via the OpenAPI component) or a SQL database to store and retrieve data associated with a user's
localId. - After a new user is created, trigger a welcome Gmail to be sent to their registered email address.
- Combine Firebase Auth with a database integration like Firestore (via the OpenAPI component) or a SQL database to store and retrieve data associated with a user's