{"id":29959176,"url":"https://github.com/mobizt/firebaseclient","last_synced_at":"2026-01-03T14:23:15.548Z","repository":{"id":219869726,"uuid":"745844457","full_name":"mobizt/FirebaseClient","owner":"mobizt","description":"🔥Fast and reliable async Firebase client library for Arduino. ","archived":false,"fork":false,"pushed_at":"2025-07-30T09:50:05.000Z","size":9101,"stargazers_count":214,"open_issues_count":0,"forks_count":18,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-07-30T11:56:49.705Z","etag":null,"topics":["arduino","cloud-firestore-database","cloud-messaging","esp32","esp8266","firebase","firebase-storage","google-cloud-functions","google-cloud-storage","raspberry-pi-pico","realtime-database"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mobizt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"mobizt","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://www.buymeacoffee.com/Mobizt"]}},"created_at":"2024-01-20T10:13:24.000Z","updated_at":"2025-07-30T09:50:10.000Z","dependencies_parsed_at":"2024-05-28T05:31:38.310Z","dependency_job_id":"672ca630-bff6-45a6-b9a2-1a467feff0c0","html_url":"https://github.com/mobizt/FirebaseClient","commit_stats":null,"previous_names":["mobizt/firebaseclient"],"tags_count":100,"template":false,"template_full_name":null,"purl":"pkg:github/mobizt/FirebaseClient","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobizt%2FFirebaseClient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobizt%2FFirebaseClient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobizt%2FFirebaseClient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobizt%2FFirebaseClient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mobizt","download_url":"https://codeload.github.com/mobizt/FirebaseClient/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobizt%2FFirebaseClient/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268618462,"owners_count":24279244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","cloud-firestore-database","cloud-messaging","esp32","esp8266","firebase","firebase-storage","google-cloud-functions","google-cloud-storage","raspberry-pi-pico","realtime-database"],"created_at":"2025-08-03T21:42:57.802Z","updated_at":"2026-01-03T14:23:15.541Z","avatar_url":"https://github.com/mobizt.png","language":"C","funding_links":["https://github.com/sponsors/mobizt","https://www.buymeacoffee.com/Mobizt"],"categories":[],"sub_categories":[],"readme":"# FirebaseClient\n\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/mobizt/FirebaseClient/.github%2Fworkflows%2Fcompile_library.yml?logo=github\u0026label=compile) [![Github Stars](https://img.shields.io/github/stars/mobizt/FirebaseClient?logo=github)](https://github.com/mobizt/FirebaseClient/stargazers) ![Github Issues](https://img.shields.io/github/issues/mobizt/FirebaseClient?logo=github)\n\n![GitHub Release](https://img.shields.io/github/v/release/mobizt/FirebaseClient) ![Arduino](https://www.ardu-badge.com/badge/FirebaseClient.svg) ![PlatformIO](https://badges.registry.platformio.org/packages/mobizt/library/FirebaseClient.svg) ![GitHub Release Date](https://img.shields.io/github/release-date/mobizt/FirebaseClient)\n\n## Introduction\n\nAsync Firebase Client library for Arduino Documentation.\n\nThis is the `REST APIs Firebase Client` library that supports the following `Firebase` and `Google Cloud` products in one place.\n\n- `Firebase Realtime Database`\n- `Cloud Firestore Database`\n- `Cloud Messaging`\n- `Firebase Storage`\n- `Google Cloud Functions`\n- `Google Cloud Storage`\n- `Security Rules Management`\n\nThis Firebase library is quite comprehensive which covers many applications. \n\nIt is suitable for all serverless applications e.g. data logging, automation and IoTs. You can choose what options and services you want to use (see [Library Build Options](#library-build-options)).\n\nThere are many types of authentications supported and you can manage the user account with sign up (user/guest), delete, verify the user and reset the user password.\n\nThis library also supports auto- and one-time authentications and you can force the library to re-authenticate any time.\n\nThis library also provides the OTA firmware update functionalities by using your Realtime Database data or Firebase/Cloud Storage object (file).\n\nNote that the Firestore data change listening and Realtime Database disconnected event are not support by the Firebase REST API.\n\nThe [bare minimum code examples](/examples/BareMinimum/) provide the basic guidelines for library usage concepts. There is a little more code that needs to be written but it is still simple and understandable.\n\nYou can create your own wrapper class as you want that provides the callback-free, cleaner and simpler API. See the [Wrapper example](/examples/RealtimeDatabase/Wrapper/) for how to.\n\nYou can use security rules to fully control the Firebase services access instead of relying only on the authentication credentials and tokens. For access control using custom claims and security rule use case, see [AccessControl](/examples/RealtimeDatabase/AccessControl/AccessControl.ino) example.\n\nThis library also provides the test tools (web client app) that are simple and ready to try without coding.\n\nTo see how Firebase Realtime Database provides the efficient, fast and reliable performance when work with this library, see  [StreamPerformanceTest](/examples/RealtimeDatabase/StreamPerformanceTest/) example.\n\nTo test notification sending with Firebase Cloud Messaging by using our FCM Web Client App, see  [WebClient](/examples/Messaging/WebClient/) example.\n\n\n## Changes since v2.1.0\n\nThe library since v2.1.0 is network independent. All network data and management classes are removed. \n\nUsers have to define the macros or build options in their sketch before including the library header file. See [Library Build Options](#library-build-options) section for the available options.\n\nThe SSL client can be set via `AsyncClientClass::setClient()` or in the `AsyncClientClass` constructors without the network options.\n\nThe `AsyncClientClass` methods that are related to the networks are removed.\n\n\n## Supported Devices\n\nESP8266, ESP32 and all 32-bit MCU except for Atmel AVR.\n\n## Installation\n\n- ### Using Library Manager\n\nAt Arduino IDE, go to menu **Sketch** -\u003e **Include Library** -\u003e **Manage Libraries...**\n\nIn Library Manager Window, search **\"firebase\"** in the search form then select **\"FirebaseClient\"**. \n\nClick **\"Install\"** button.\n\nFor `PlatformIO` IDE, use the following command.\n\n**pio lib install \"FirebaseClient\"\"**\n\nOr at **PIO Home** -\u003e **Library** -\u003e **Registry** then search **FirebaseClient**.\n\nIn case ESP32, PlatformIO's platform-espressif32 core is outdated. You should use [pioarduino](https://github.com/pioarduino) platform instead. \n\n- ### Manual installation\n\nFor `Arduino IDE`, download the zip file from the repository (Github page) by select **Code** dropdown at the top of repository, select **Download ZIP** \n\nFrom Arduino IDE, select menu **Sketch** -\u003e **Include Library** -\u003e **Add .ZIP Library...**.\n\nChoose **FirebaseClient-main.zip** that previously downloaded.\n\nRename folder from **FirebaseClient-main** to **FirebaseClient**.\n\nGo to menu **Files** -\u003e **Examples** -\u003e **FirebaseClient** and choose one from examples.\n\n\n- ### RP2040/RP2350 Arduino SDK installation\n\nFor Arduino IDE, the Arduino-Pico SDK can be installed from Boards Manager by searching pico and choose Raspberry Pi Pico/RP2040 to install.\n\nFor PlatformIO, the Arduino-Pico SDK can be installed via platformio.ini\n\n```ini\n[env:rpipicow]\nplatform = https://github.com/maxgerhardt/platform-raspberrypi.git\nboard = rpipicow\nframework = arduino\nboard_build.core = earlephilhower\nmonitor_speed = 115200\nboard_build.filesystem_size = 1m\n```\n\nSee this Arduino-Pico SDK [documentation](https://arduino-pico.readthedocs.io/en/latest/) for more information.\n\n\u003e [!NOTE]  \n\u003e You cannot install Arduino IDE and Arduino library in Microsoft's `OneDrive` folder because the `OneDrive` folder is the sandbox or virtual folder instead of real folder which causes the path error when compilation.\n\n\n\n## Usages\n\nFor new `Firebase` users, please read the [Project Preparation and Setup](#project-preparation-and-setup) section for preparing the Firebase project.\n\nFor new library user that the project was setup and prepared, see the [bare minimun examples](/examples/BareMinimum/) to start using this library with minimum code that is required by this library.\n\nFor more examples, please click [here](/examples/).\n\n### Working Principle \n\nThis library can be used in two modes i.e. async mode and await or sync mode.\n\nWith async mode, the task will be stored in the FIFO queue. The result of the running task can be obtained via the callback function or the proxy object that assign when calling the functions.\n\nThe `AsyncClientClass` is the proxy class that provides the queue for async tasks and also the information of task process when working in await or sync mode.\n\nThe async task that is stored in the queue contains the preprocess HTTP request data (headers without auth tokens and payload). \n\nThe SSL Client that is assigned with the `AsyncClientClass` constructor will be the network client used for all async tasks in its queue.\n\nThe result of a async task can be obtained from the `AsyncResult` class object. This object provides the debug, authentication process event, error information and the response payload of the request.\n\nIf no async callback function is assigned with the function, the `AsyncResult` class object should be assigned otherwise it will work in sync mode.\n\nIn this case, it should be polling read for new available information from the `AsyncResult` at the end of the loop function.\n\nIn the await or sync mode, task will be processed immediately and waits for the end of process when the response is complete or time out or error occurred.\n\nThe information (debug/error) can be obtained by the `AsyncClientClass` that assign with the function. The response payload or processed value will be obtained if no errors.\n\nThe authentications support by this library covers user, service account (admin) and no authentications.\n\nThere are authentication classes that store the sign-in and authentication credentials whuch can be used temporary as it will be duplicated to use later.\n\nThe authentication tokens are also supported e.g. custom (signed JWT token), ID and access tokens. The refresh token also supports. User can use third party app/services to create these auth token when sign-in and authentication credentials are sensitive and not allowed to store in the sketch.\n\nThese authentication tokens (excepts for Reltime Database secret) are the short-lived tokens. It will be expired in 60 minutes.\n\nThe `FirebaseApp` class will be used to handle the authentication task. Some function that executes in the loop function will keep the authentication process running e.g. `FirebaseApp::loop`.\n\nThe authentication process is the task that involved auth token generation using sign-in, auth credentials and tokens that user assigned with the `initializeApp` function.\n\nThe `initializeApp` function is the static function which also allows the authentication process to work in async and await or sync modes.\n\nIn version 2.x.x and later, when assign the timeout (\u003e 0) to the `initializeApp` function, the authentication task will be processed in await or sync mode.\n\nThe callback function assigned with `initializeApp` function will provide the auth process event, debug and error information while authenticating in async and sync modes.\n\nIn version 2.x.x, the `FirebaseApp` class can also maintain the async tasks that stored in other `AsyncClientClass`s.\n\nThe details for all classes used in this library are available. Click the following links for details. \n\n\n- [RealtimeDatabase Class](resources/docs/realtime_database.md)\n\n- [Firestore::Databases Class](resources/docs/firestore_database.md)\n\n- [Firestore::Documents Class](resources/docs/firestore_database_document.md)\n\n- [Firestore::Values Class](/resources//docs//firestore_database_values.md)\n\n- [Messaging Class](resources/docs/messaging.md)\n\n- [MessagingInstance Class](resources/docs/messaging_instance.md)\n\n- [Storage Class](resources/docs/storage.md)\n\n- [CloudStorage Class](resources/docs/cloud_storage.md)\n\n- [CloudFunctions Class](resources/docs/cloud_functions.md)\n\n- [Security Ruls Management Class](resources/docs/rules.md)\n\n- [Authentications Classes](resources/docs/auth_class.md). \n\n- [AsyncClient Class](/resources//docs//async_client.md)\n\n- [AsyncResult Class](/resources//docs//async_result.md)\n\n- [FirebaseApp Class](/resources//docs/firebase_app.md)\n\n- [FirebaseClient Class](/resources/docs/firebase_client.md)\n\n- [File and Blob Classes](/resources/docs/file_config.md)\n\n- [JSON Writer Class](/resources//docs/json_writer.md)\n\n- [Some Placeholder Class](/resources/docs/placeholders.md)\n\n\n### OTA Update\n\nThe OTA firmware update is supported using bin file stored in `Firebase Storage` and `Google Cloud Storage` buckets or base64 encoded data stored in `Realtime Database`.\n\nThe Arduino devices that natively supported OTA firmware update are `ESP8266`, `ESP32` and `Raspberry Pi Pico`.\n\nSince FirebaseClient v1.3.1, the OTA update in Arduino SAMD21 boards that use NINA firmware and WiFi101 firmware was supported using [Internal_Storage_OTA](https://github.com/mobizt/Internal_Storage_OTA) library.\n\n\nThe [Internal_Storage_OTA](https://github.com/mobizt/Internal_Storage_OTA) is the modified version of [WiFi101OTA](http://www.arduino.cc/en/Reference/WiFi101OT) library which contains only four required files e.g. `Internal_Storage_OTA.h`, `InternalStorage.h`, `InternalStorage.cpp`and `OTAStorage.h`.\n\n\nTo allow OTA update in SAMD21 Arduino boards, you have to include `Internal_Storage_OTA.h` in your sketch.\n\nThen assign the `InternalStorage` class object to be used for `Realtime Database` via `RealtumeDatabase::setOTAStorage`,  for `Google Cloud Storage` via `CloudStorage::setOTAStorage` and for `Firebase Storage` via `Storage::setOTAStorage`\n\nIn SAMD21 Arduino boards, if `OTA Storage` was not set before calling OTA function, the error `OTA Storage was not set` will be occurred.\n\nFinally, once the OTA update was finished, in case [Internal_Storage_OTA](https://github.com/mobizt/Internal_Storage_OTA), you have to call `InternalStorage.apply()` to apply the update and then restart.\n\nSome OTA libraries that provide `Storage Class` object that derived from the modified version of Arduino WiFi101OTA's `OTAStorage` class can also be used.\n\n\n## Project Preparation and Setup\n\n\u003cdetails\u003e\n\u003csummary\u003eClick here for details.\u003c/summary\u003e\n\nYou have to setup the Firebase project to use `Firebase products`. Visit [Understand Firebase Projects](https://firebase.google.com/docs/projects/learn-more) to learn more about Firebase projects.\n\nFor new Firebase user, go to the [Google Firebase Console](https://console.firebase.google.com/), sign in to your Google account, and create a new project as the following images.\n\n![Create a project](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/blank_account_create_a_project.png)\n\n![Name a project](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/create_a_project_step1.png)\n\n![Ignore the Google Analytics](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/create_a_project_step2.png)\n\nClick `All products` button.\n\n![All products](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_all_products.png)\n\n### Authentication Getting Started\n\nWhen `custom token`, `ID token` authorization are used via `CustomAuth`, `UserAuth`, `CustomToken` and `IDToken`, the `Authentication` service is needed and must be set up otherwise the `HTTP status code 400` error will show in the async callback.\n\n\u003e [!NOTE]  \n\u003e The `Authentication` service is not required for `OAuth2.0 access token authentication using service account` authentication and legacy token (database secret) authorization.\n\nTo get started with `Authentication`,  choose `Authentication` and click `Get started` button.\n\n![Authentication Get Started](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_authentication_get_started.png)\n\nUnder Sign-in providers, choose Email/Password.\n\n![Authentication Select Email/Password Provider](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_authentication_get_started_step1.png)\n\nSelect `Enable` check option in `Email/Password` section, and click `Save` button.\n\n![Authentication Enable Email/Password](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_authentication_get_started_step2.png)\n\nThen click `Users` tab, click `Add user` button.\n\n![Authentication Add User](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_authentication_get_started_step3.png)\n\nFill in the `Email` and `Password` and click `Add user` button.\n\nOnce the `Authentication` was setup, the `Web API Key` will be generated. See the `Project Settings` page for `Web API Key`. \n\n![Authentication Web API Key](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_authentication_get_started_step4.png)\n\nThe `Web API Key` is used in all `custom token`, `ID token` authentications that used via the `CustomAuth`, `UserAuth`, `CustomToken` and `IDToken` provider classes and it was assign to the `API_KEY` in the exampless.\n\nSee [API Keys Overview](https://cloud.google.com/api-keys/docs/overview) and [Authenticate by using API keys](https://cloud.google.com/docs/authentication/api-keys) for more details. \n\nAt the `Authentication` page, under `Sign-in method` tab, other Sign-in providers can be added.\n\nTo add `Anonymous` sign-in provider, click `Add new provider` button.\n\n![Authentication Anonymous Provider](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_authentication_get_started_step5.png)\n\nSelect enable check option in Email/Password section, and click `Save` button.\n\n![Authentication Enable Anonymous Provider](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_authentication_get_started_step6.png)\n\n### Realtime Database Getting Started\n\nTo get started with `Firebase Realtime Database`, choose `Realtime Database` and click `Create Database`. \n\n![Create Database](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_rtdb_create_database.png)\n\nSet up your `Database options` and `Security rules`.\n\n![Set Database Location](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_rtdb_setup_database_step1.png)\n\n#### Note for Realtime Database location selection\n\nRefer to this [Realtime Database locations](https://firebase.google.com/docs/projects/locations#rtdb-locations), the `Database URL scheme` depends on the `Region name` (Realtime Database location) you selected.\n\nIn some Arduino boards that works with [`WiFiNINA`](https://github.com/arduino/nina-fw) and `WiFi101` firmwares, the database URL that ends with `firebasedatabase.app` may not work after the SSL certificate was upload into the board firmware which causes Realtime Database server connection failure. \n\nThis issue was found on MKR 1000 WiFi board with `WiFi101`firmware at the moment while MKR WiFi 1010 with [`WiFiNINA`](https://github.com/arduino/nina-fw) firmware does not have certificate issue.\n\nWe don't investigate in to the Arduino firmwares to find the root cause, then `us-central1` region for `DATABASE_NAME.firebaseio.com` URL should be selected for this case.\n\n![Set Database Security Rules](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_rtdb_setup_database_step2.png)\n\nYou can choose `Start in locked mode` or `Start in test mode` for `Security rules`.\n\nOnce the database was created, click the `Rules` tab and change the `Security rules` as following to allow the basic authentication, click `Publish` button to apply the changes.\n\n```yaml\n{\n  \"rules\": {\n    \".read\": \"auth != null\", \n    \".write\": \"auth != null\"\n  }\n}\n```\n![Change Database Security Rules](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_rtdb_setup_database_step3.png)\n\nThe warning `Your security rules are not secure. Any authenticated user can steal, modify, or delete data in your database.` will be displayed due to insecure rules which you can change it for more secure later.\n\nVisit [Understand Firebase Realtime Database Security Rules](https://firebase.google.com/docs/database/security) to learn more about security rules.\n\nThe reference url is the `DATABASE_URL` that defined and used in the `Realtime Database` examples can be obtained from the `Data` tab as the following.\n\n![Realtime Database Reference URL](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_rtdb_reference_url.png)\n\nThe reference url or database url also can be taken from the `Service Account` key file, see [Service Account](#service-account) section.\n\n#### Realtime Database Legacy Usage\n\nThe database secret is the secret key for privileged accessing the `Realtime Database` service.\n\nThe database secret is now currently deprecated. Alternatively, to use the `Realtime Database` with the same privileged access as database secret but secured, the `OAuth2.0 access token authentication using service account` via `ServiceAuth` provider class is recommended.  \n\nTo get the database secret, in the `Project Settings` page in the [`Google Firebase Console`](https://console.firebase.google.com/), under the `Service accounts` Tab, click `Database secret`.\n\n![Realtime Database Database Secret on Service Accounts Tab](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_rtdb_secret_key_step1.png)\n\nThe database secret for the databases are available in the `Secrets` column.\n\n![Realtime Database Database Secret Table](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_rtdb_secret_key_step2.png)\n\n### Google Cloud Firestore Database Getting Started\n\nTo get started with `Cloud Firestore Database`, choose `Cloud Firestore` and click `Create database`. \n\n![Create Firestore Database](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_firestore_create_database.png)\n\nSet up your database `Name and Location` and `Security rules`.\n\n\u003e [!NOTE]  \n\u003e The first database name (ID) is `(default)` which cannot be changed.\n\n![Set Name and Location](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_firestore_create_database_step1.png)\n\n![Set Security Rules](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_firestore_create_database_step2.png)\n\nOnce the database was created, click the `Rules` tab and change the `Security rules` as following to allow the basic authentication, click `Publish` button to apply the changes.\n\n```yaml\nrules_version = '2';\nservice cloud.firestore {\n  match /databases/{database}/documents {\n    match /{document=**} {\n      allow read, write: if request.auth.uid != null;\n    }\n  }\n}\n```\n![Change Security Rules](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_firestore_create_database_step3.png)\n\nVisit [Get started with Cloud Firestore Security Rules](https://firebase.google.com/docs/firestore/security/get-started) to learn more about security rules.\n\n### Storage Getting Started\n\nTo get started with `Storage`, choose `Storage` and click `Get started`. \n\n![Storage Get Started](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_storage_get_started.png)\n\nThen set the `Secure Rules for Cloud Storage` and `Cloud Storage location`.\n\n![Secure Rules for Cloud Storage](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_storage_get_started_step1.png)\n\n![Set Cloud Storage location](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_storage_get_started_step2.png)\n\nOnce the storage bucket was created, click the `Rules` tab and change the `Security rules` as following to allow the basic authentication, click `Publish` button to apply the changes.\n\n```yaml\nrules_version = '2';\nservice firebase.storage {\n  match /b/{bucket}/o {\n    match /{allPaths=**} {\n      allow read, write: if request.auth.uid != null\n    }\n  }\n}\n```\n\n![Change Security Rules](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_storage_get_started_step3.png)\n\nVisit [Get started with Firebase Security Rules](https://firebase.google.com/docs/storage/security/get-started) to learn more about security rules.\n\nThe folder path is the `STORAGE_BUCKET_ID` that defined and used in the Storage examples can be obtained from the `Files` tab as the following.\n\n![Storage folder path](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_storage_folder_path.png)\n\nThe folder path or the `STORAGE_BUCKET_ID` also can be taken from the `Service Account` key file, see [Service Account](#service-account) section.\n\n### Google Cloud Functions Getting Started\n\nTo use the `Cloud Functions` for running your backend automate code, the billing plan for the project is needed to be upgraded to at least `Blaze` plan.\n\n![Functions Get Started](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_functions_get_started.png)\n\n![Functions Upgrade Billing Plan](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_functions_get_started_step1.png)\n\nYou can `Set a billing budget` at this step or skip it.\n\n![Functions Upgrade Plan Purchase](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_functions_get_started_step2.png)\n\n![Functions Upgrade Purchased](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_functions_get_started_step3.png)\n\nClick the `Get started` button and follow the steps as show in the following images.\n\n![Functions Install command line tools](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_functions_get_started_step4.png)\n\n![Functions Finishing](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_functions_get_started_step5.png)\n\n\u003e [!IMPORTANT]  \n\u003e The `Cloud Build API` and `Cloud Run Admin API` must be enabled, click [here](https://console.developers.google.com/apis/library/cloudbuild.googleapis.com) to enable `Cloud Build API`and [here](https://console.cloud.google.com/apis/library/run.googleapis.com) to enable `Cloud Run Admin API`.\n\n\n### Cloud Messaging Getting Started\n\n![Cloud Messaging Get Started](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_messaging_get_started.png)\n\nCreate an app (iOS, Android, Web, or Unity app) for getting started.\n\nThe following steps showed the web app (Javascript) is created.\n\n![Cloud Messaging Register App](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_messaging_get_started_step1.png)\n\nAdd the Firebase SDK and click `Continue to console` button.\n\n![Cloud Messaging Add Firebase SDK](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/firebase_console_messaging_get_started_step2.png)\n\nAfter you register the web app in your Firebase project, the next step is you have to use Firebase SDK to use the Firebase services (FCM for this case). \n\n\nThe FCM web app that consists of html document and related scripts requirs the server (local or remote) to run, you cannot access or browse your web app by opening the file from your local computer via file protocol (file://). \n\nThe FCM SDK is supported only in pages served over HTTPS. This is due to its use of service workers, which are available only on HTTPS sites (remote host) or HTTP (local host). If you need a provider, Firebase Hosting is recommended and provides a no-cost tier for HTTPS hosting on your own domain.\n\nThere are the choises that you can access the Firebase SDK in your web app. \n\n1. Install the [Firebase SDK](https://firebase.google.com/docs/web/setup/#add-sdks-initialize) using the [Firebase CLI](https://firebase.google.com/docs/cli/).\n\n2. Access the Firebase SDK via [the global CDN or npm for Node.js apps](https://firebase.google.com/docs/web/alt-setup).\n\nThis library provides the ready to test **FCM Web Client App** in [examples/Messaging/WebClient](examples/Messaging/WebClient/). You can host this FCM web app files (fcm.html and fcm.php) in your local (php) server (localhost via http) or remote (php) server (https only).\n\nYou can open [examples/Messaging/WebClient/fcm.html](examples/Messaging/WebClient/fcm.html) via web browser to review and follow the instructions on that page.\n\nIn Windows 11 PC, even notification is granted for your site in the brower notification settings, the notification may go directly to the notification center instead of displaying pop-up, if **Do not disturb** is **On** in the **System \u003e Notifications** of Windows settings and you have to turn it **Off** to allow the notification pop-up to show.\n\n\nThe app (iOS, Android, Web and Unity) registration token or `DEVICE_TOKEN` is a unique token string that identifies each client app instance. The registration token is required for single device and device group messaging. Note that registration tokens must be kept secret, see [this](https://firebase.google.com/docs/cloud-messaging/concept-options#credentials) for more info.\n\n\n### Service Account\n\nA service account is a special kind of account (bot or application account) that belongs to app instead of to an individual end user. Service accounts enable server-to-server interactions between an app and a Google service.\n\n#### Types of service accounts\n\nIn Google Cloud services, there are several different types of service accounts:\n\n- User-managed service accounts: Service accounts that you create and manage. These service accounts are often used as identities for workloads.\n\n- Default service accounts: User-managed service accounts that are created automatically when you enable certain Google Cloud services e.g. `Firebase Admin SDK Service Account`. You are responsible for managing these service accounts.\n\n- Google-managed service accounts: Google-created and Google-managed service accounts that allow services to access resources on your behalf.\n\nA `Firebase Admin SDK Service Account` is created automatically when you create a Firebase project or add Firebase to a Google Cloud project and it is used to communicate with Firebase.\n\nThe `Service Account` credentials are required for the `ServiceAuth` and `CustomAuth` classes.\n\nTo generate and download `Service Account` private key file, in the `Project Settings` page in the [`Google Firebase Console`](https://console.firebase.google.com/), click `Service accounts` tab and `Generate new private key`. \n\nTo use `Service Account` in your sketch, open the .json file that is already downloaded with the text editor.\n\n```json\n{\n  \"type\": \"service_account\",\n  \"project_id\": \"...\",\n  \"private_key_id\": \"...\",\n  \"private_key\": \"-----BEGIN PRIVATE KEY-----\\n...\\n-----END PRIVATE KEY-----\\n\",\n  \"client_email\": \"...\",\n  \"client_id\": \"...\",\n  \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n  \"token_uri\": \"https://oauth2.googleapis.com/token\",\n  \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n  \"client_x509_cert_url\": \"...\",\n  \"universe_domain\": \"googleapis.com\"\n}\n```\n\nCopy the `project_id`, `client_email` and `private_key` from .json file and paste to these defines in the example.\n\n```cpp\n#define FIREBASE_PROJECT_ID \"...\" // Taken from \"project_id\" key in JSON file.\n#define FIREBASE_CLIENT_EMAIL \"...\" // Taken from \"client_email\" key in JSON file.\nconst char PRIVATE_KEY[] PROGMEM = \"-----BEGIN PRIVATE KEY-----\\n...\\n-----END PRIVATE KEY-----\\n\"; // Taken from \"private_key\" key in JSON file.\n```\n\nNormally `Firebase Admin SDK Service Account` is used in Firebase APIs authentication/authorization.\n\nTo access `Google Cloud APIs` e.g. `Google Cloud Storage`, `Google Cloud Functions` services, you have to update the service account permissions.\n\n#### Service Account Permissions\n\nWhen the `Firebase Admin SDK Service Account` was used for Google Cloud APIs authentication/authorization, you have to update its permissive roles.\n\nThe `Basic roles` are highly permissive roles that used to grant principals broad access to Google Cloud resources.\n\nWe can add one of `Basic roles` i.e. `Editor` and/or `Owner`.\n\nTo add the Basic's `Owner` or `Editor` roles, go to the [Identity and Access Management console](https://console.cloud.google.com/iam-admin).\n\nThen choose the project, and select the `VIEW BY PRINCIPALS` tab.\n\nFrom the table displayed, look at the `firebase-adminsdk` in the `Name` column, then click the pencil icon on the right side in this table row to `Edit principal`. \n\n![IAM Add Permission](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/iam_add_permission_step1.png)\n\nAdd the role `Editor` and/or `Owner` under the `Basic` roles and click `Save` button.\n\nWait a few minutes for the action to propagate after adding roles. \n\n![IAM Add Roles](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/iam_add_permission_step2.png)\n\n\u003c/details\u003e\n\n## Memory Options\n\n- ### Memory Options for ESP8266\n\nWhen you update the ESP8266 Arduino Core SDK to v3.x.x, the memory for Heap and stack can be choosen from the IDE.\n\nYou can choose the Heap memory between internal and external memory chip from IDE e.g. Arduino IDE and PlatformIO on VSCode or Atom IDE.\n\n- #### Arduino IDE\n\n\nFor ESP8266 devices that don't have external SRAM/PSRAM chip installed, choose the MMU **option 3**, 16KB cache + 48KB IRAM and 2nd Heap (shared).\n\n![Arduino IDE config](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/esp8266_heap_option_arduino_ide.png)\n\nFor ESP8266 devices that have external 23LC1024 SRAM chip installed, choose the MMU **option 5**, 128K External 23LC1024.\n\n![MMU VM 128K](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/esp8266_psram_option_arduino_ide.png)\n\nFor ESP8266 devices that have external ESP-PSRAM64 chip installed, choose the MMU **option 6**, 1M External 64 MBit PSRAM.\n\n\n- #### PlatformIO IDE\n\nThe MMU options can be selected from build_flags in your project's platformio.ini file\n\nFor ESP8266 devices that don't not have external SRAM/PSRAM chip installed, add build flag as below.\n\n```ini\n[env:d1_mini]\nplatform = espressif8266\nbuild_flags = -D PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48_SECHEAP_SHARED\nboard = d1_mini\nframework = arduino\nmonitor_speed = 115200\n```\n\n\nFor ESP8266 devices that have external 23LC1024 SRAM chip installed, add build flag as below.\n\n```ini\n[env:d1_mini]\nplatform = espressif8266\n;128K External 23LC1024\nbuild_flags = -D PIO_FRAMEWORK_ARDUINO_MMU_EXTERNAL_128K\nboard = d1_mini\nframework = arduino\nmonitor_speed = 115200\n```\n\n\nFor ESP8266 devices that have external ESP-PSRAM64 chip installed, add build flag as below.\n\n```ini\n[env:d1_mini]\nplatform = espressif8266\n;1M External 64 MBit PSRAM\nbuild_flags = -D PIO_FRAMEWORK_ARDUINO_MMU_EXTERNAL_1024K\nboard = d1_mini\nframework = arduino\nmonitor_speed = 115200\n```\n\n\n- #### ESP8266 and SRAM/PSRAM Chip connection\n\nMost ESP8266 modules don't have the built-in SRAM/PSRAM on board. External memory chip connection can be done via SPI port as below.\n\n```\n23LC1024/ESP-PSRAM64                ESP8266\n\nCS (Pin 1)                          GPIO15\nSCK (Pin 6)                         GPIO14\nMOSI (Pin 5)                        GPIO13\nMISO (Pin 2)                        GPIO12\n/HOLD (Pin 7 on 23LC1024 only)      3V3\nVcc (Pin 8)                         3V3\nVcc (Pin 4)                         GND\n```\n\nOnce the external Heap memory was selected in IDE, to allow the library to use the external memory, you can define this macro in your sketch before including the library header file `FirebaseClient.h`.\n\n\n```cpp\n#define ENABLE_PSRAM\n```\n\nThis macro was defined by default when you installed or update the library.\n\n\n\n- ### Memory Options for ESP32\n\nIn ESP32 module that has PSRAM installed, you can enable it and set the library to use this external memory instead.\n\n- #### Arduino IDE\n\nTo enable PSRAM in ESP32 module.\n\n![Enable PSRAM in ESP32](https://raw.githubusercontent.com/mobizt/FirebaseClient/main/resources/images/esp32_psram_option_arduino_ide.png)\n\n\n- #### PlatformIO IDE\n\n\nIn PlatformIO on VSCode or Atom IDE, add the following build_flags in your project's platformio.ini file.\n\n```ini\nbuild_flags = -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue\n```\n\nAs in ESP8266, once the external Heap memory was selected in IDE, to allow the library to use the external memory, you can define this macro in your sketch before including the library header file `FirebaseClient.h`.\n\n```cpp\n#define ENABLE_PSRAM\n```\n\n\n## Library Build Options \n\nThe library build options are defined as preprocessor macros (`#define name`).\n\nSince version 2.1.0, there are no predefined build options, user needs to define what he wants to use before compiling. \n\nThe build options can be defined before including the library header file `FirebaseClient.h` or as the compiler build flags.\n\nThe available options are the following.\n\n```cpp\nENABLE_DATABASE // For RTDB compilation\nENABLE_FIRESTORE // For Firestore compilation\nENABLE_FIRESTORE_QUERY // For Firestore Query feature compilation\nENABLE_MESSAGING // For Firebase Cloud Messaging compilation\nENABLE_STORAGE // For Firebase Storage compilation\nENABLE_CLOUD_STORAGE // For Google Cloud Storage compilation\nENABLE_FUNCTIONS // For Google Cloud Functions compilation\nENABLE_RULESETS // For RuleSets compilation\nENABLE_PSRAM // For enabling PSRAM support\nENABLE_OTA // For enabling OTA updates support\nENABLE_FS // For enabling Flash filesystem support\n\nFIREBASE_ASYNC_QUEUE_LIMIT // For maximum async queue limit (number).\nFIREBASE_PRINTF_PORT // For Firebase.printf debug port class object.\nFIREBASE_PRINTF_BUFFER // Firebase.printf buffer size.\n\n// For enabling authentication and token\nENABLE_SERVICE_AUTH\nENABLE_CUSTOM_AUTH\nENABLE_USER_AUTH\nENABLE_ACCESS_TOKEN\nENABLE_CUSTOM_TOKEN\nENABLE_ID_TOKEN\nENABLE_LEGACY_TOKEN\n```\n\n## Known Issues\n\n### Slow Arduino IDE Compilation Speed\n\nNormally this issue can be existed due to large anount of files to be compiled and anti virus software interference.\n\nThis library contains the large anount of C files from `BearSSL` engine used in the internal `ESP_SSLClient` library which will be used only when the `ServiceAuth`, `CustomAuth` and `ESP_SSLClient` classes are used. This can increase the compilation time.\n\nIf `ServiceAuth`, `CustomAuth` and `ESP_SSLClient` classes are not used in your code, you can remove or delete the `src/client` folder to reduce the Arduino IDE compilation time.  \n\n## License\n\nThe codes and examples in this repository are licensed under the MIT License. \n\nCopyright (c) 2026, Suwatchai K. All rights reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n*The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.*\n\n`THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.`\n\n*Last updated 2026-01-03 UTC.*","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobizt%2Ffirebaseclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmobizt%2Ffirebaseclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobizt%2Ffirebaseclient/lists"}