Firebase integration and document ID

Hi, I am using the new firebase integration but I need a way to save the document ID offline, do the changes and then update the document in firebase once the changes are done with the document id.

I know there is a way to pull it directly by using the get method but is there a easier way?

The usual way of doing that, is to read (get) the document then set up some variables with document data which you can change as you want and then using put or patch (for patch you need http method only, for put you can do it with rest api integration too) depending on whether you want to change some parts of the document (patch) or replace the whole document (put) you can write the new data back in the database.
So in your case if you want to use the firebase integration, you need to get the data then use the set data variable function, then change your data variable and use the update record function to write back.
But as i said be careful because with update record if you have a record with ten fields but you want to change only one, you need to have all ten of them in the data variable no matter if you changed them or not.

Hope you understand and helps y

1 Like

Hi Dimos,

Please can you advise me. I am trying to get the direct integration working with email and password authentication but I keep getting a CORS error:

I have white-labelled the domain in my firebase side as well and just need to find out if there might be something else I am doing incorrectly.

If I change the firebase read permissions to null then it works but as soon as authentication is required it gives a cors error.

Is there a way i implement a http call to include the clients token when doing the call?

Hi there, to tell you the truth i haven’t yet gotten to the firebase rules yet so im not quit familiar with that problem but i think this could help you because from what i understand you need to ‘pass’ authentication in http request ?

https://firebase.google.com/docs/database/rest/auth#authenticate_with_an_access_token

Thank you Dimos,

I will have a look at the docs

1 Like

Hi Dimos,

I have tried everything but i cant get it to read the documents with basic auth.

I am trying it in postman to speed things up but no luck

Hey maybe its a good idea to make a separate post but also share more info like your http request url

1 Like