5757
Views
30
Comments
[Firebase] How to Configure the Firebase Plugin
Question
firebase
Reactive icon
Forge asset by 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.

UserImage.jpg
Nathaniel Elrod

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.

UserImage.jpg
Nathaniel Elrod

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

UserImage.jpg
Claudiu Ene

Nathaniel Elrod wrote:

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


note: FIRST PUBLISH. Only after that you can go to Module Management - Site Properties and see the FireBaseProjectID and FirebaseSecret

UserImage.jpg
basha reta

Claudiu Ene wrote:

Nathaniel Elrod wrote:

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


note: FIRST PUBLISH. Only after that you can go to Module Management - Site Properties and see the FireBaseProjectID and FirebaseSecret

where do post that ? Effective Value


UserImage.jpg
kevin febriano

hello, how about use firebase in mobile?

UserImage.jpg
Luiz Fernando Nascimento da Cruz

Hi, I need to integrate my web application with Firebase Cloud Message, but after several tests I still can't make it work, do you have any tutorial on how to use it?

2018-05-03 15-48-34
Samuel Jesus
Staff

Luiz Fernando Cruz wrote:

Hi, I need to integrate my web application with Firebase Cloud Message, but after several tests I still can't make it work, do you have any tutorial on how to use it?

Hello Luiz,

There are 2 specific connectors just for Firebase Cloud Message: one for mobile and one for the web.

Check them out and see if they solve your issue :)

Cheers,

Samuel Jesus

UserImage.jpg
Dileep Rajam

How do i get the project id? and do i have to match the Project name created in Firebase to the module/screen name created in Outsystems

2018-08-17 06-46-51
Salvador Romeu Vives

I've got the same problem, in AppMobile don't work.

UserImage.jpg
Dileep Rajam

Hi Team

Please help me configure firebase for mobile app. 

How do i get the project id? and do i have to match the Project name created in Firebase to the module/screen name created in Outsystems


2018-05-03 15-48-34
Samuel Jesus
Staff

Hello Venkata,

The name if your project can be whatever you want, and it there is no need to be equal to your OutSystems module. The connection between OutSystems and Firebase is done using the project ID and not the name.

To get the ProjectID, on the Firebase console, go to Project settings, and in the first tab (General), you will find that information:


Cheers,

Samuel Jesus

UserImage.jpg
Dileep Rajam

Samuel Jesus wrote:

Hello Venkata,

The name if your project can be whatever you want, and it there is no need to be equal to your OutSystems module. The connection between OutSystems and Firebase is done using the project ID and not the name.

To get the ProjectID, on the Firebase console, go to Project settings, and in the first tab (General), you will find that information:


Cheers,

Samuel Jesus


Hi Samuel,

i got the firebase working for my chat in one mobile app and the chat is now interactive; 

I have another app where i want to get the same chat feature enabled with firebase. so i tried to use the same firebase configurations and chat is not working. So i created another project in firebase console and tried using these new configurations(ProjectID and Firebase secret) but no luck.

can you please help me with this.


thanks,

-Venkata

UserImage.jpg
Dileep Rajam

Venkata Rajam wrote:

Samuel Jesus wrote:

Hello Venkata,

The name if your project can be whatever you want, and it there is no need to be equal to your OutSystems module. The connection between OutSystems and Firebase is done using the project ID and not the name.

To get the ProjectID, on the Firebase console, go to Project settings, and in the first tab (General), you will find that information:


Cheers,

Samuel Jesus


Hi Samuel,

i got the firebase working for my chat in one mobile app and the chat is now interactive; 

I have another app where i want to get the same chat feature enabled with firebase. so i tried to use the same firebase configurations and chat is not working. So i created another project in firebase console and tried using these new configurations(ProjectID and Firebase secret) but no luck.

can you please help me with this.


thanks,

-Venkata

The issue is now fixed. i forgot to set event on my chat component in the new environment. It is all good now. thank you for your support


2018-07-11 08-35-50
Rui Mendes

Hi Basha.

Go to <your environment url>/ServiceCenter
Login and find your application under the Factory menu, Application list.


Clicking the name of your application will lead you to its detail page.

Find the Module where you are using the Firebase component and click the name.

In this case, I'm using In-App Chat Web app as an example.

I'm using the In-App Chat Web component in the Sample, so I'll be setting the values there.


Go to the Site Properties tab and select the property you want to set.

Paste your ProjectId in the textarea and click Apply.

Do the same for the Secret and your Firebase component should be working.

Hope this helps.

Cheers

UserImage.jpg
basha reta

Rui Mendes wrote:

Hi Basha.

Go to <your environment url>/ServiceCenter
Login and find your application under the Factory menu, Application list.


Clicking the name of your application will lead you to its detail page.

Find the Module where you are using the Firebase component and click the name.

In this case, I'm using In-App Chat Web app as an example.

I'm using the In-App Chat Web component in the Sample, so I'll be setting the values there.


Go to the Site Properties tab and select the property you want to set.

Paste your ProjectId in the textarea and click Apply.

Do the same for the Secret and your Firebase component should be working.

Hope this helps.

Cheers

thanks,I followed the instructions but it still won't connect. I ran the application and nothing appears in firebase need to do something else.


2018-07-11 08-35-50
Rui Mendes

Hi Basha.

Firebase changed its process in creating a database for the project. You now have two options:

Locked Mode and Test Mode.
In Locked Mode, the database cannot be updated, and so, the receiver is not notified on the changes.

Please try the settings for the Test Mode, by changing your database rules to the following:

{
   "rules":  {
       ".read" : true,
       ".write" : true
   }
}


Hope this helps.

Cheers

2020-03-10 21-01-27
Roman

Rui Mendes wrote:

Hi Basha.

Firebase changed its process in creating a database for the project. You now have two options:

Locked Mode and Test Mode.
In Locked Mode, the database cannot be updated, and so, the receiver is not notified on the changes.

Please try the settings for the Test Mode, by changing your database rules to the following:

{
   "rules":  {
       ".read" : true,
       ".write" : true
   }
}


Hope this helps.

Cheers

Hi Rui,


Do you know what why auth config rule won't work? I get unauthorized, although auth header is being passed. 


// These rules grant access to a node matching the authenticated
// user's ID from the Firebase auth token
{
  "rules": {
    "users": {
      "$uid": {
        ".read": "$uid === auth.uid",
        ".write": "$uid === auth.uid"
      }
    }
  }
}

2018-10-22 02-52-54
Helios

Everything was great until the

Generate a Firebase Token 1c and 1d part. Does anybody have a working demo on how to apply this?

2018-07-11 08-35-50
Rui Mendes

Hi Helios.

Please take a look at these components, that are all setup and ready to use.

In-App Notifications Mobile / Web 

In-App Chat Mobile / Web

All you need to do is set the ProjectId and Secret in ServiceCenter.


Hope this helps.

Cheers,
Rui Mendes

2020-03-10 21-01-27
Roman

It looks like rules below are not secure. Does anyone have any recommendations? 

2020-03-11 09-18-27
Jorick van Rijs

I try to configure the firebase component for web. I have already succeeded in the past but now I constantly get a 401 unauthorized error. I configured everything like the first post. 


Thnx in advance!

2020-03-10 21-01-27
Roman

Jorick van Rijs wrote:

I try to configure the firebase component for web. I have already succeeded in the past but now I constantly get a 401 unauthorized error. I configured everything like the first post. 


Thnx in advance!

Hi Jorick, as suggested above you should try this:

Please try the settings for the Test Mode, by changing your database rules to the following:

{
   "rules":  {
       ".read" : true,
       ".write" : true
   }
}


2022-07-07 18-45-50
Niels Favreau

Hello!


Currently the component is using the deprecated way. (database secret)
Are we going to see an updated version any time soon of the component which is not using the deprecated way?

Greetings,
Niels F.

2023-12-12 08-53-15
Cristiano Marques
 
MVP

Hey all,


Is this still working for mobile? I used this in the past and was working but now I don't get this working anymore.

I do get the messages sent to the Firebase Database but on the mobile I don't get any event triggered.


Best regards

2020-03-10 21-01-27
Roman

Cristiano Marques wrote:

Hey all,


Is this still working for mobile? I used this in the past and was working but now I don't get this working anymore.

I do get the messages sent to the Firebase Database but on the mobile I don't get any event triggered.


Best regards

Hi, this one works fine for me https://www.outsystems.com/forge/component-overview/1406/firebase 


2022-09-01 23-57-30
Everton Motonio Lima

Hi, I saw this video and I follow all the steps and did not worked, anybody else had problem?

https://www.youtube.com/watch?v=ygbu3AITS4k

UserImage.jpg
Goldy Lukka

Those who are still getting a 401 error in-spite of doing all the steps correctly, please ensure you selected "Realtime Database" as the database.

UserImage.jpg
Andy_Oscky

Hi guys anybody can help me 

i have a problem , i can not generate the token data . I use the following data 

thanks

2019-11-19 18-04-26
Fabricio Aguiar

Hi

This error appears when executing the action "GanerateToken"
Has anyone experienced this?
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.