# Services : Firebase : Files ## Overview ``` HOME/.cache/firebase/emulators/cloud-firestore-emulator-v1.19.7.jar HOME/.cache/firebase/emulators/firebase-database-emulator-v4.11.2.jar HOME/.cache/firebase/emulators/ui-v1.11.8/ HOME/.config/configstore/firebase-tools.json HOME/.config/configstore/update-notifier-firebase-tools.json PROJ/.firebaserc PROJ/firebase.json Private Key aka Firebase Certificate (ex: myproject-a1b2c-firebase-adminsdk-d9t3q-0833842cd6.json) ``` #### Originating Commands ``` firebase login # creates ~/.config/configstore/firebase-tools.json # first user in obj["user", "tokens"] firebase login:add # authenticate another account >> firebase-tools.json # additional users in obj["additionalAccounts"][n]["user, "tokens] firebase init # create Firebase project files in local dir firebase init emulators # downloads emulator files to .cache/firebase/emulators/ ``` ## Example Contents #### ~/.config/configstore/firebase-tools.json ```json { "motd": { "cloudBuildErrorAfter": 1594252800000, "cloudBuildWarnAfter": 1590019200000, "defaultNode10After": 1594252800000, "minVersion": "3.0.5", "node8DeploysDisabledAfter": 1613390400000, "node8RuntimeDisabledAfter": 1615809600000, "node8WarnAfter": 1600128000000, "fetched": 1715008657066 }, "usage": true, "analytics-uuid": "aa60827c-d71f-4080-b12a-cf54f04421c1", "user": { "iss": "accounts.google.com", "azp": "563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com", "aud": "563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com", "sub": "102674923576757147409", "email": "[email protected]", "email_verified": true, "at_hash": "6KAqPOezWJ9DkPQ96eZNuw", "iat": 1714762571, "exp": 1714766171 }, "tokens": { "expires_at": 1715012279969, "refresh_token": "1//05H...93-chars...myA", "scopes": [], "access_token": "ya2...219-chars...178", "expires_in": 3599, "scope": "https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/firebase openid", "token_type": "Bearer", "id_token": "eyJ...894-chars...KMw" }, "additionalAccounts": [ { "user": { "iss": "accounts.google.com", "azp": "563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com", "aud": "563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com", "sub": "116268402001216398674", "hd": "somecompany.io", "email": "[email protected]", "email_verified": true, "at_hash": "9bGE7GokbudlhjB-iPmDXA", "iat": 1714766149, "exp": 1714769749 }, "tokens": { "expires_at": 1714769748604, "access_token": "ya2...218-chars...177", "expires_in": 3599, "refresh_token": "1//05t...94-chars...7Cg", "scope": "https://www.googleapis.com/auth/firebase https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/cloud-platform openid", "token_type": "Bearer", "id_token": "eyJ...931-chars...Dcw" } } ], "activeAccounts": { "/home/ofer/src/tmp/firebase": "[email protected]" }, "activeProjects": { "/home/ofer/src/tmp/firebase": "foobar-7a653" } } ``` #### ~/.config/configstore/update-notifier-firebase-tools.json ```json { "optOut": false, "lastUpdateCheck": 1715008656060 } ``` #### .firebaserc ```json { "projects" : { "default" : "myproject-a1b2c" } } ``` #### firebase.json Set host to "0.0.0.0" to bind to IPv4 + IPv6 — needed inside Docker container. ```json { "emulators" : { "ui" : { "enabled" : true, "host" : "0.0.0.0", "port" : 9101 }, "auth" : { "host" : "0.0.0.0", "port" : 9102 }, "database" : { "host" : "0.0.0.0", "port" : 9103 }, "firestore" : { "host" : "0.0.0.0", "port" : 9104 }, "singleProjectMode" : true } } ``` #### Private Key aka Firebase Certificate ```json { "type" : "service_account", "project_id" : "myproject-a1b2c", "private_key_id" : "083...34-chars...d92", "private_key" : "-----BEGIN PRIVATE KEY-----\nMII...1668-chars...4SH\n-----END PRIVATE KEY-----\n", "client_email" : "[email protected]", "client_id" : "104...15-chars...200", "auth_uri" : "https://accounts.google.com/o/oauth2/auth", "token_uri" : "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url" : "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url" : "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-d9t3q%40myproject-a1b2c.iam.gserviceaccount.com", "universe_domain" : "googleapis.com" } ```