Connect Firepress to Firebase
In order for your Firepress app to interact with Firebase services, you need to add your Firebase project configuration to your Firepress app.
Last updated
Was this helpful?
In order for your Firepress app to interact with Firebase services, you need to add your Firebase project configuration to your Firepress app.
Last updated
Was this helpful?
Details of the two files you need to create can be found in your project's /config
folder.
Firebase projects support Google , which can be use to call Firebase server APIs from trusted environments.
In order for your development server to interact with Firebase services we will use credentials obtained via this service account to authorize server requests.
You can read more about it here -
To authenticate a service account and authorize it to access Firebase services, you must generate a private key file in JSON format.
To generate a private key file for your service account:
In the Firebase console, open Settings > .
Click Generate New Private Key, then confirm by clicking Generate Key.
Rename the file to service-account.json
and add the file to your Firepress app's /config
folder.
To get the config object for a Firebase Web App:
In the Firebase console, open Settings > General
In the Your apps card, select the nickname of the app for which you need a config object.
Select Config from the Firebase SDK snippet pane.
Create a new firebase.config.js
file in your Firepress app's /config
folder and add the config object snippet.
At this point the basic connection between Firepress and Firebase has been made so you can spin up the development environment and have a look around.
Run the command npm run dev
In order to perform database updates from the UI we need to set up an admin user. You will remember from a previous section that we enabled authentiction with the Google provider sign in, as well as restricting database operations to users with the custom claim of editor. We will now finish this process by setting up and admin user with the right claims.
Sign In with the google account that is to be used as the admin user.
This process will have registered a user within Firebase. -- You can go to the Authentication section of the Firebase Console, click on the Users tab and you should see the newly created user.
Next we will grant editing permisssions to the admin account.
To do this, shut down the development environment, and run the command:
npm run grant-editor <admin email address>
Runing the above will have assigned our admin account with the claim of editor
, but in order to start editing from the UI we must re-sign in.
Start the development environment using npm run dev
.
The Firepress CMS toolbar should now appear at the top of page.
With the development environment running, go to
Go to and click the Sign Out button.
Go back to and sign back in using the Google provider.