[Firebase] How to Configure the Firebase Plugin

[Firebase] How to Configure the Firebase Plugin

Forge Component
Published on 16 May by OutSystems Labs
8 votes
Published on 16 May by OutSystems Labs

Create a FirebaseProjectId and a FirebaseSecret

1. Create two new site properties called FirebaseProjectId and FirebaseSecret.

2. Configure the Firebase credentials.
    a. Go to the Firebase console. You will need to log in with your Google credentials.
    b. Create a new project.
    c. Go to Project Settings > Service Accounts > Database Secrets, copy the Database Secret and set that value to the Component’s SiteProperty "FirebaseSecret".

    d. Copy the Project Id and set that value to the Component’s SiteProperty "FirebaseProjectId".

Adding References to the Firebase Plugin

1. In your Application Module, click the Manage Dependencies button.

2. Add references to Firebase > Server Actions > GenerateToken.

Generate a Firebase Token

1. In your application, go to the Logic tab and create a new server action to generate a Firebase token.

    a. Create a new server action with two output parameters: FirebaseToken and FirebaseProjectId. Rename this new server action to GetFirebaseData.

      b. Use the GenerateToken server action provided by the Firebase plugin, passing the Site.FirebaseSecret and the UserId in its parameters.

If you are going to use more than one component that uses Firebase plugin, you only need to generate token and ProjectId once. You can use the same configuration for all components.


c. Pass the FirebaseToken value provided from GenerateToken server action and Site.FirebaseProjectId to the output parameter.


  d. Use the GetFirebaseData action whenever you need the Firebase Token and ProjectId.