Important: in this documentation, we will show you how to quickly implement Firebase, but with basic settings. If you want to increase the security of your firebase settings, read the Firebase documentation here: https://firebase.google.com/docs
Create your Account on Firebase at https://firebase.google.com
You can register to the Free Spark Plan which is enough for working with Thorium.
We now have to create a first Project:
GO TO THE FIREBASE CONSOLE
ADD A NEW PROJECT
SET THE NAME OF THE PROJECT
YOUR PROJECT IS NOW READY
At this step, we need to create a Firebase App, and then get all our API keys (Firebase SDK Configuration)
GO TO THE PROJECT SETTINGS
ADD AN APP (WEB TYPE)
ENTER THE NAME OF YOUR APP
COPY SOMEWHERE THE FIREBASE PARAMETERS (IN THE RED SQUARE)
It is now necessary to setup the Firebase Auth in order to decide how the users will connect to your Firebase project:
CLICK ON AUTHENTIFICATION
SELECT SETUP SIGN-IN METHOD
ENABLE EMAIL/PASSWORD PROVIDER
SELECT THE OTHER PROVIDERS YOU WANT TO ENABLE
You can enable Anonymous if you want the users to connect by default to your Mobile App without having to register-signin.
At the moment, Thorium only implements Email-Password, Facebook, Twitter and Google Sign-In providers
Now we need to setup Cloud Firestore. Cloud Firestore is the NoSQL Database, we will use it for storing Data.
CLICK ON CREATE DATABASE
SELECT START IN PRODUCTION MODE
CHOOSE YOUR LOCATION SETTINGS
SELECT THE “RULES” OPTION
CHANGE THE RULE EXACTLY LIKE IN THE SCREEN SHOT
Setting the Rule to ALLOW READ, WRITE: IF REQUEST.AUTH != NULL; is the easiest way for starting your project, but for a more advanced and secure setup, please read the Firebase documentation: Get started with Cloud Firestore Security Rules
Now we need to setup Firebase Storage. We need it to store the user’s profile images and the various documents (Images, Audio…) we will add to the Cloud Firestore Database.
SELECT THE “STORAGE” OPTION
EDIT THE STORAGE RULES AND CHANGE IT AS SHOWN
ALLOW READ, WRITE: IF REQUEST.AUTH != NULL;
CHOOSE YOUR CLOUD STORAGE LOCATION
OUR STORAGE IS READY!
Your Firebase Configuration is now ready, it is time to setup the Thorium Part.
You need first to enable the Firebase Plugin in your Thorium Project, click on the Project name in the Thorium Projects list, and select the Plugins tab:
ENABLE THE Google Firebase PLUGIN
EDIT THE STORAGE RULES AND CHANGE IT AS SHOWN
ALLOW READ, WRITE: IF REQUEST.AUTH != NULL;
Choose your preferences for your Thorium Project
Set the profile image store folder to “userprofiles” for example.
And choose if you want the users to connect anonymously and/or select the Sign-In providers you want to enable.
Your Environment is now ready, you can start working on your App.
Your API key will be exposed in the file thorium.config.js, but this is not a security issue as the apiKey in this configuration snippet just identifies your Firebase project on the Google servers. It is not a security risk for someone to know it.
...