Assuming you have created and initialized a Firebase project:
- Specify the project ID and Key in
main.py. - Specify the Realtime Database Rules.
- Install the dependencies.
Get the "apiKey" and "Project ID" for your project from Firebase->Project Overview->Project settings->General and replace these placeholders in main.py:
APIKEY = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
PROJECT_ID = 'bbbbbbbbbb'
In "Firebase->Build->Realtime Database->Rules" replace the default rules with these rules, then publish.
{
"rules": {
"id": {
"$uid" : {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
},
"data": {
"$uid" : {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
},
"more_data": {
"$uid" : {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
}
}
}
This example uses the "Production-ready rules", for "content-owner only access". Google Docs.
To see the database contents, go to "Firebase->Build->Realtime Database->Data"
pip3 install pyrebase4
requirements = python3,kivy, pyrebase4, gcloud, googleapis-common-protos, protobuf, httplib2, pyparsing, oauth2client, pyasn1, pyasn1-modules, rsa, pycryptodome, python-jwt, jws, requests, certifi, charset-normalizer==2.1.1, idna, urllib3, requests-toolbelt , jwcrypto, cryptography, deprecated, wrapt
android.permissions = INTERNET
As of 2022/08 Pyrebase4 does not run on kivy-ios. The error message is OSError: Cannot load native module 'Crypto.Hash._SHA256'..... and it is due to the lack of a pycryptodome recipe.