Firebase icon

Firebase

Interact with Firebase Admin SDK

Authentication → Update User

AI-generated

Overview

This node integrates with the Firebase Admin SDK to manage user authentication data. Specifically, the "Update User" operation under the "Authentication" resource allows updating various attributes of an existing Firebase user account. This is useful in scenarios where you need to programmatically modify user details such as email, display name, phone number, or account status within your Firebase project.

Practical examples include:

  • Updating a user's email address after they request a change.
  • Marking a user's email as verified after manual verification.
  • Disabling a user account due to suspicious activity.
  • Changing the display name or phone number for profile updates.

Properties

Name Meaning
User UID The unique identifier (UID) of the user to update.
Email The new email address to assign to the user.
Display Name The new display name for the user.
Phone Number The new phone number for the user.
Email Verified Boolean flag indicating whether the user's email is verified (true or false).
Disabled Boolean flag indicating whether the user account should be disabled (true or false).

Output

The output JSON contains the updated user object returned by Firebase after the update operation. It includes fields such as:

  • uid: The user's unique identifier.
  • email: Updated email address.
  • displayName: Updated display name.
  • phoneNumber: Updated phone number.
  • emailVerified: Whether the email is verified.
  • disabled: Whether the user account is disabled.
  • creationTime and lastSignInTime: Timestamps converted to ISO string format.
  • Other user metadata fields except internal metadata and provider data are removed for clarity.

If the update fails, the output will contain an error message describing the issue.

Dependencies

  • Requires a valid Firebase service account JSON credential configured in n8n credentials.
  • Uses Firebase Admin SDK's Authentication module.
  • Proper permissions must be granted to the service account to perform user management operations.

Troubleshooting

  • Invalid service account JSON format: Ensure the provided Firebase service account JSON is correctly formatted and complete.
  • Failed to initialize Firebase: Check that the service account has the necessary permissions and the JSON is valid.
  • Operation not supported: Verify that the selected operation is "Update User" under the "Authentication" resource.
  • Invalid custom claims JSON format (not applicable here but relevant for other operations): Make sure any JSON input is properly formatted.
  • If the node throws errors related to missing or invalid UIDs, confirm that the "User UID" property is correctly set and corresponds to an existing user.
  • Network or permission issues may cause failures; ensure the environment running n8n can reach Firebase services and the credentials have sufficient rights.

Links and References

Discussion