Closed Niltonsf closed 3 years ago
Thank you for informing the issue.
The problem is the API key is missing from all Firestore examples.
Please see the RTDB examples about the API key assignment.
The Email, Password, API Key are the credentials for id token generation.
There is no incomplete or missing token error info in Firestore functions right now and I will fix this in the next update.
I'm apologize for this inconvenient.
@mobizt Oh ok. This:
/* 2. Define the Firebase project host name and API Key */
#define FIREBASE_HOST "PROJECT_ID.firebaseio.com"
#define API_KEY "API_KEY"
into my code? Should I only insert this part in the Firestore's examples?
@mobizt I have added:
#define FIREBASE_HOST "PROJECT_ID.firebaseio.com"
#define API_KEY "API_KEY"
void setup(){
config.host = FIREBASE_HOST;
config.api_key = API_KEY;
}
I could successfully create the document, great work!
@mobizt Could you help me accessing the fbdo.payload(). I have attempted doing what is written but I might be doing it wrong: This is what I receive:
Get a document...
PASSED
------------------------------------
{
"name": "projects/automacao-com-aplicativo/databases/(default)/documents/user_data/MwAeYz8RnlQdTf4zqxV7gxOJREg2/Buttons/botao1",
"fields": {
"nome_botao": {
"stringValue": "botao1"
},
"value": {
"booleanValue": true
},
"nome": {
"stringValue": "Quarto"
},
"icon": {
"stringValue": "LightBulb"
}
},
"createTime": "2021-02-01T17:59:56.695439Z",
"updateTime": "2021-02-01T18:13:49.703817Z"
}
I have attempted doing this:
if (Firebase.Firestore.getDocument(&fbdo, FIREBASE_PROJECT_ID, "", documentPath.c_str(), mask.c_str()))
{
Serial.println("PASSED");
Serial.println("------------------------------------");
Serial.println(fbdo.payload());
json = fbdo.jsonObject();
json.get(jsonData, "value");
Serial.println(jsonData.type);
Serial.println("------------------------------------");
Serial.println();
}
I want to get the Boolean value from the result I received.
The payload response is not set to the internal FirebaseJson of Firebasse Data object as in the RTDB right now.
At this time you can do external parse like this.
FirebaseJson json;
FirebaseJsonData jsonData;
json.setJsonData(fbdo.payload());
json.get(jsonData, "fields/value/booleanValue");
Serial.println(jsonData.stringValue);
@mobizt Hello, I'm trying to work with your new Firestore library. I'm attempting to a Create_Document, I haven't changed any info for creating the document, I have only inserted WIFI info, Authentication info and the firebase_id.
This is where I got the project id: This is the following error I got: