- The service account will register user org and sign JWT key (server-side)
- Firebase rules will share their documents through JWT (client-side will load data from firebase)
Create account on console.firebase and the project realtime database.
Please add to environment variable your firebase url export FIREBASE_URL=https://YOUR-PROJECT-DATABASE.firebaseio.com
Please add Service Account with [Datastore Role] and do not forget save json his key as export FIREBASE_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\nMII...=\n-----END PRIVATE KEY-----\n
Open Rules tab in Database section. Link will looks like
https://console.firebase.google.com/project/[project-name]/database/firestore/rules.
Copy and paste then:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /Org/{token}/{document=**} {
allow read, write, update, delete: if request.auth.token.org == token;
}
}
}Please add Single field exemptions for device filter:
- Collection:
Devices - Field:
device_id,updated_at - Query scope:
Collection group
Please add Composite Index for device filter and sort:
Those links may help, please change [project-name] to you application name in firstore:
export export GOOGLE_MAPS_API_KEY=AIz...Nkg && \
export SHARED_DASHBOARD=1 && \
export ADMIN_TOKEN=admin && \
export PASSWORD=qwerty && \
export FIREBASE_URL=https://geolocation-console.firebaseio.com && \
export FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nMI...bNw==\n-----END PRIVATE KEY-----\n" && \
export FIREBASE_PROJECT_ID=geolocation-console && \
export FIREBASE_CLIENT_EMAIL=geolocation-console@appspot.gserviceaccount.com
./src/server/firebase/check.js
./bin/migration.js


