-
Click the button "Get Started"
-
Click the button "Add Project"
-
Add a project Name
-
Disable "Enable Google Analytics for this project" checkbox and click "Create project"
-
Select the desired Location and click "Next"
-
Locate the DB URL and the rules editor This is the "Firebase URL" to be used by the API
-
Select Sign-in method tab and click the "Email/Password" Button and then click "Save" Button
-
Go to the Project Overview (click the gear button) and select "Project Settings", find the Web "API_Key"
Open Sign In Example.vi and update the "API_KEY" and "Firebase URL" with the ones obtained in the previous steps
This Example will add your USER to the autenticated Users list
Open Log in and Post.vi Example, use your "API_KEY", "Firebase URL" and your Authenticated user to POST something to your Real Time Database, in this example we published a cluster called data, data is the endPoint name
Until this point your Real Time Database is open to any autenticated user, we can create rules to match our neads, for example, if this database is meant to be used by a company we can create rules to allow reading and/or writting for an specific domain
Rules Example 1, allow writting and reading from specific domain users:
{
"rules": {
".read": "auth.token.email.endsWith('@domain.com')",
".write": "auth.token.email.endsWith('@domain.com')",
}
}
Rules Example 2, allow writting and reading from specific domain and filtering enabled to search under data/date
{
"rules": {
"data" : {
".indexOn": ["date"]
},
".read": "auth.token.email.endsWith('@domain.com')",
".write": "auth.token.email.endsWith('@domain.com')",
}
}
After you instal the VIPM Package there is an example provided for you, just drag it into your Block diagram and test it after setup your Firebase Database.
For more rules examples go to:
https://medium.com/@juliomacr/10-firebase-realtime-database-rule-templates-d4894a118a98
https://firebase.google.com/docs/rules