Skip to content

Commit 26da34d

Browse files
committed
Update documentation
1 parent 6a9958a commit 26da34d

File tree

1 file changed

+46
-57
lines changed

1 file changed

+46
-57
lines changed

README.md

Lines changed: 46 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
[![GitHub Sponsors](https://img.shields.io/github/sponsors/mobizt?logo=github)](https://github.com/sponsors/mobizt)
88

9-
Revision `2025-01-24T18:25:17Z`
9+
Revision `2025-01-25`
1010

1111
## Table of Contents
1212

@@ -86,7 +86,7 @@ Revision `2025-01-24T18:25:17Z`
8686

8787
Async Firebase Client library for Arduino Documentation.
8888

89-
This library is the `REST APIs Firebase Client` that supports the following `Firebase` and `Google Cloud` products in one place.
89+
This is the `REST APIs Firebase Client` library that supports the following `Firebase` and `Google Cloud` products in one place.
9090

9191
- `Firebase Realtime Database`
9292
- `Cloud Firestore Database`
@@ -95,38 +95,26 @@ This library is the `REST APIs Firebase Client` that supports the following `Fir
9595
- `Google Cloud Functions`
9696
- `Google Cloud Storage`
9797

98-
This [`FirebaseClient`](https://github.com/mobizt/FirebaseClient) library was created to solve the following issues in the old Firebase library.
98+
This Firebase library is comprehensive and provides more usage flexibilities. You can chose what you only want to use (see [Library Build Options](#library-build-options)) and you can work with any network interfaces and authentications.
9999

100-
- The confusion of different library names from the same developer and other developers in Library Manager.
101-
- The different main header file name and class name issue.
102-
- The long path issue due to long library name with spaces leads to `VisualMicro IDE` compilation error.
103-
- The central settings using only single config class can cause the usage confusion.
104-
- The system time changes causes the auth token expiry period calculation error.
105-
- The internal SSL Client and WiFiClient issue causes the session need to be closed at some interval.
106-
- The `Realtime Database` stream event data can be missing due to the sync read operation.
107-
- The async operation is not truely impremented.
108-
- The library's code size is quite large. This new library code size is 170k smaller which requires only 80k - 110k program space.
100+
In addition, this library provides the sync and async usage modes which they can be mixed. The async mode provides responsive application with zero delay.
109101

110-
> [!IMPORTANT]
111-
> If you are new to `Firebase Products`, please read the [Project Preparation and Setup](#project-preparation-and-setup) section first.
112-
113-
> [!IMPORTANT]
114-
> For ESP8266 device usage, you should read the [Memory Options for ESP8266](#memory-options-for-esp8266) section for heap selection.
115-
116-
> [!NOTE]
117-
> The Cloud Firestore Database data change listening does not support by REST API.
102+
The library's powerful debugding system allows you to understand what is going on when it is running or failed.
118103

119-
This library provides the usage flexibilities. You can chose what you only want to use (see [Library Build Options](#library-build-options)) and you can use with any network interfaces and authentications.
104+
The network configuration (identifier) class, authentication configuration class and the SSL client class can be plug and play. They can be changed on-the-fly.
120105

121-
In addition, this library provides the sync and async usage modes which can be mixed. The async mode provides your code more dynamic with zero delay usage excepts only small delays used during SPI Ethernet module initializing.
106+
The [bare minimum code examples](/examples/BareMinimum/) provide the basic guidelines for library usage concepts. Even though it contains more lines of code, it is still simple and understandable but efficient.
122107

123-
The powerful debugding system allows you to understand what is going on when it is running or failed.
108+
You can create your own wrapper class as you want that provides the callback-less, cleaner and simpler API but well managed, powerfull and reliable. See the [Wrapper example](/examples/RealtimeDatabase/Simple/Wrapper/) for how to.
124109

125-
The network identifier class, authentication class and the SSL client class can be plug and play. They can be on-the-fly switchable.
110+
> [!IMPORTANT]
111+
> If you are new to `Firebase` products, please read the [Project Preparation and Setup](#project-preparation-and-setup) section first.
126112
127-
The [bare minimum code examples](/examples/BareMinimum/) provide the basic guidelines for library usage concepts. Even though it contains more lines of code, it is still simple but efficient.
113+
> [!IMPORTANT]
114+
> For ESP8266 device user, you should read the [Memory Options for ESP8266](#memory-options-for-esp8266) section for heap selection.
128115
129-
You can create your own wrapper class as you want that provides the callback-less, cleaner and simpler API but well managed, powerfull and reliable. See the [Wrapper example](/examples/RealtimeDatabase/Simple/Wrapper/) for how to.
116+
> [!NOTE]
117+
> The Firestore data change listening and Realtime Database disconnected event are not support by the Firebase REST API.
130118
131119
## Frequently Asked Questions
132120

@@ -168,34 +156,35 @@ For the FAQ (Frequently Asked Questions), please visit [here](/FAQ.md).
168156

169157
This library required the latest device's **platform Core SDK** to be installed.
170158

159+
160+
For Arduino IDE, the ESP8266 Core SDK can be installed through **Boards Manager**.
161+
162+
For PlatformIO IDE, the ESP8266 Core SDK can be installed through **PIO Home** > **Platforms** > **Espressif 8266 or Espressif 32**.
163+
164+
The RP2040 boards required [Arduino-Pico SDK](https://github.com/earlephilhower/arduino-pico) from Earle F. Philhower to be installed.
165+
171166
> [!IMPORTANT]
172167
> Please make sure that the `Arduino IDE's Board Manager URL` is up to date before you update your device's `platform Core SDK`. Any issue due to using out dated `platform Core SDK` is your own risk and does not support by library.
173168
>
174169
> In case the library compile status showed here is passing and your code compilation is error, you should check your libary installation, `platform Core SDK` installation and the library usage. You cannot install library in the cloud storage virtual folder or sandbox e.g. `Microsoft's OneDrive`.
175170
171+
> [!IMPORTANT]
172+
> If you are using `Arduino® MKR 1000 WIFI`, please make sure you have already done the following steps.
173+
> - Add the `Realtime Database host root certificate` to the board firmware.
174+
> - Install the WiFi101 library and uninstall or remove the WiFiNINA library from the libraries folder if it was installed.
175+
176176
> [!IMPORTANT]
177177
> If you are using `Arduino UNO R4 WiFi`, `Arduino Portenta C33`, `Arduino MKR WiFi 1010`, `Arduino NANO 33 IoT`, and `Arduino Nano RP2040`, please make sure you have already done the following.
178178
> - Add the `Realtime Database host root certificate` to the board firmware. Plese see [Upload SSL root certificates](https://support.arduino.cc/hc/en-us/articles/360016119219-Upload-SSL-root-certificates) for how to.
179179
> - Install the WiFiNINA library.
180180
181-
> [!IMPORTANT]
182-
> If you are using `Arduino® MKR 1000 WIFI`, please make sure you have already done the following.
183-
> - Add the `Realtime Database host root certificate` to the board firmware.
184-
> - Install the WiFi101 library and uninstall or remove the WiFiNINA library from the libraries folder if it was installed.
185-
186181
Some Arduino MKR devices have the problem when connecting to the Realtime database URL that ends with `firebasedatabase.app`. Please see [Note for Realtime Database location selection](#note-for-realtime-database-location-selection) for more information.
187182

188183
> [!WARNING]
189184
> Known problem in `PlatformIO IDE` compilation, if you are using `Arduino® UNO R4 WiFi` board and using the `Firebase Realtime Database`, your `Arduino® UNO R4 WiFi` board will stop with the error: `"Fault on interrupt or bare metal(no OS) environment"`.
190-
> This is the error related to the `Realtime Database` server certificate issue in WiFiS3 library that compiled with `PlatformIO IDE` even you are already uploaded the SSL root certificates of `Realtime Database` server using the Arduino IDE Certificate Upload tool.
191-
> This problem is only specific to `Firebase Realtime Database` in `Arduino® UNO R4 WiFi` which compiled using `PlatformIO IDE` only.
192-
>
193-
194-
For Arduino IDE, the ESP8266 Core SDK can be installed through **Boards Manager**.
195-
196-
For PlatformIO IDE, the ESP8266 Core SDK can be installed through **PIO Home** > **Platforms** > **Espressif 8266 or Espressif 32**.
185+
> This is the error related to the `Realtime Database` server certificate handling in WiFiS3 library that compiled with `PlatformIO IDE` even you are already uploaded the SSL root certificates of `Realtime Database` server using the Arduino IDE Certificate Upload tool.
186+
> This problem is only specific to `Firebase Realtime Database` with `Arduino® UNO R4 WiFi` that compiled using `PlatformIO IDE` only.
197187
198-
The RP2040 boards required [Arduino-Pico SDK](https://github.com/earlephilhower/arduino-pico) from Earle F. Philhower to be installed.
199188

200189
## Incompatability Between Old Firebase Library and This Firebase Library.
201190

@@ -243,7 +232,8 @@ In the old Firebase library, this feature was done internally by the internal SS
243232

244233
If you want to use this feature and if you use ESP32, you can use `ESP_SSLClient` library that included in this library and set the `WiFiClient` as the client.
245234

246-
The following example code is for using `TCP KeepAlive` with `WiFiClient` and built-in `ESP_SSLClient` in ESP32.
235+
<details>
236+
<summary>For using TCP KeepAlive with WiFiClient and built-in ESP_SSLClient in ESP32, please click here.</summary>
247237

248238
```cpp
249239

@@ -293,6 +283,7 @@ void loop()
293283
}
294284

295285
```
286+
</details>
296287

297288
- ### PSRAM
298289

@@ -385,28 +376,27 @@ This authorization token will be expired in 60 minutes or 3600 seconds which det
385376

386377
The authorization token will be refreshed or re-created automatically as long as the async authentication task handler (`FirebaseApp`) was running in the main loop without blocking by user code.
387378

388-
> [!WARNING]
389-
> Most examples use the token for autorization. The token will be refreshed/recreated automatically as mentioned above.
390-
>
391-
> The `FirebaseApp` event will show the authentication processes that are running behind. The authentication task handler will prepare and maintain the authorization token to be valid. Google may deny the access from the client that sending the request with the expired authorization token.
392-
>
393-
> Anyway, library also provides the option for less or non-secure usage which no authorization tokens are involved i.e. using database secret (`LegacyToken`) for Realtime database and using no authorization token (`NoAuth`) if the security rules are allowed (see the [Project Preparation and Setup](#project-preparation-and-setup) section).
394-
>
395-
> You can get started using this library with these [bare minimun examples](https://github.com/mobizt/FirebaseClient/blob/main/examples/BareMinimum/) or these [simple Realtime database examples](https://github.com/mobizt/FirebaseClient/blob/main/examples/RealtimeDatabase/Simple) which using database secret and no token, which are similar to the other legacy Firebase library usage.
396-
>
397-
> For secure and more elaborate usages, you have to read the documentation thouroughly and follow the library provided examples to get familiar with the library usage.
379+
Most examples use the token for autorization. The token will be refreshed/recreated automatically as mentioned above.
380+
381+
The `FirebaseApp` event will show the authentication processes that are running behind. The authentication task handler will prepare and maintain the authorization token to be valid. Google may deny the access from the client that sending the request with the expired authorization token.
382+
383+
Anyway, library also provides the option for less or non-secure usage which no authorization tokens are involved i.e. using database secret (`LegacyToken`) for Realtime database and using no authorization token (`NoAuth`) if the security rules are allowed (see the [Project Preparation and Setup](#project-preparation-and-setup) section).
384+
385+
You can get started using this library with these [bare minimun examples](https://github.com/mobizt/FirebaseClient/blob/main/examples/BareMinimum/) or these [simple Realtime database examples](https://github.com/mobizt/FirebaseClient/blob/main/examples/RealtimeDatabase/Simple) which using database secret and no token, which are similar to the other legacy Firebase library usage.
386+
387+
For secure and more elaborate usages, you have to read the documentation thouroughly and follow the library provided examples to get familiar with the library usage.
398388

399389
The authorization token types that can be used for Firebase/Google APIs authorization are `ID token` and `access token` which will be called shorter as `auth tokens` in this library.
400390

401-
The following authentication/authorization classes generate and hold the `ID token` to be used in the authorization requests.
391+
The following authentication/authorization classes hold the credentials for use in the intermediate process (token generator) for providing the `ID token` for authorization requests.
402392

403393
- The `UserAuth` class is for `User Sign-in authentication` which is the only authentication method that allows user to sign in for confirming the identity of a user and it provides the `ID token` to use in the authorization requests.
404394

405395
- The `IDToken` class is for `ID token authorization`, which the `ID token` that obtained from the user authentication process in other applications will be used for authorization request.
406396

407-
- The `CustomAuth` class is for `ID token authorization using service account`. The `Service Account` will be used for user authentication and it also provides the `ID token` that uses in the authorization requests. This allows the client to acess the services on behalf of user with custom `UID`.
397+
- The `CustomAuth` class is for `ID token authorization using service account`. The `Service Account` will be used for user authentication and it also provides the `ID token` that uses in the authorization requests. This allows the client to acess the services on behalf of user with custom `UID`, claims and scopes.
408398

409-
The `CustomAuth` class and `ServiceAuth` class which will discus later required the crypto library to sign the JWT token.
399+
The `CustomAuth` class and `ServiceAuth` class which will discus later use the crypto library to sign the JWT token.
410400

411401
The `BearSSL` engine library that includes in `ESP_SSLClient` library that comes with this FirebaseClient library will be used to handle this cryptographic tasks.
412402

@@ -415,8 +405,7 @@ This `BearSSL` and `ESP_SSLClient`libraries are enabled or included by default w
415405
If you want to authenticate with Custom Token using custom claims signed `JWT` token via `CustomToken` class below or never use the `ServiceAuth` and `CustomAuth` classes and `ESP_SSLClient` library, you can disable `BearSSL` inclusion by defining the macros/build flags `DISABLE_CUSTOM_AUTH` and `DISABLE_SERVICE_AUTH` in [src/Config.h](src/Config.h) or `src/UserConfig.h`, see [Library Build Options](#library-build-options) section.
416406

417407

418-
- The `CustomToken` class is for `ID token authorization using custom token`, which the custom claims signed `JWT` token obtained from the user authentication process in other applications e.g. NodeJS server side app that runs Firebase Admin SDK and working with the Service Account JSON file
419-
, will be used in the authorization requests.
408+
- The `CustomToken` class is for `ID token authorization using custom token`, which the custom claims signed `JWT` token obtained from the user authentication process in other applications e.g. NodeJS server side app that runs Firebase Admin SDK and working with the Service Account JSON file, will be used in the authorization requests.
420409

421410
For crating Custom token using Service Account JSON file and Firebase Admin SDK in server side app, visit [Create Custom Tokens](https://firebase.google.com/docs/auth/admin/create-custom-tokens) documentation from Firebase for more information.
422411

@@ -1175,7 +1164,7 @@ CustomToken::save(<file_config_data>)
11751164
The expire period should be less than the remaining time to live of your signed `JWT` token.
11761165

11771166
> [!NOTE]
1178-
> Only valid `RS256` signed `JWT` token can be used with Firebase Products and Google Cloud Product that provided in this library.
1167+
> Only valid `RS256` signed `JWT` token can be used with Firebase and Google Cloud products that provided in this library.
11791168
11801169
Some Arduino boards that have built-in crypto chip e.g. [ATECC608A](https://www.microchip.com/en-us/product/atecc608a) do not support RSA-256 algorithm and its crypto library cannot use to create the signed JWT token used in this library.
11811170

@@ -2946,7 +2935,7 @@ A service account is a special kind of account (bot or application account) that
29462935

29472936
#### Types of service accounts
29482937

2949-
In Google Cloud, there are several different types of service accounts:
2938+
In Google Cloud services, there are several different types of service accounts:
29502939

29512940
- User-managed service accounts: Service accounts that you create and manage. These service accounts are often used as identities for workloads.
29522941

0 commit comments

Comments
 (0)