[Firebase] How to Configure the Firebase Plugin

[Firebase] How to Configure the Firebase Plugin

  
Forge Component
(9)
Published on 24 Aug by OutSystems Labs
9 votes
Published on 24 Aug 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.

I do not know where to paste the information from 2c and 2d.  There are only 5 fields to past it in:  Name, Description, Data Type, Default Value, and Is Multi-tenant.


I have tried pasting the information into Default Value, but it states 'Default Value' must be set to a 'Text' literal value.  Pasting the information anywhere else does not work.

I found what I needed.  Module Management>Site Properties.