cannot add data to firebase

I used also this one
I can read BUT not write

also as you will see in the blocks I dont send any info about UID and still have access unless the email is just enough

{
  "rules": {
    "some_path": {
      "$uid": {
        // Allow only authenticated content owners access to their data
        ".read": "auth !== null && auth.uid === $uid",
        ".write": "auth !== null && auth.uid === $uid"
      }
    }
  }
}

So if I need to make a chat app or similar is best to discard the firebase extension and go with the web component?

Which extension is it? (I was previously referring to the native firebase component, not an extension)

Perhaps the extension developer can help ?

You should not really ever need to use the database secrets key....

I apologize..
Its the native firebase component as you mentioned it. The extension is for authenticator.

Did someone used the native firebase component for data storing?

I have set these rules:

{
  "rules": {
    "messages": {
      "$uid": {
        // Allow only authenticated content owners access to their data
             ".read": "$uid === auth.uid",
        ".write": "$uid === auth.uid"
      }
    }
  }
}

and used the below block

image

I have used it as well without the ''messages/'' part because I have set the bucket in the settings..

When I try to write data as above then I get no error message for some reason but no data is stored.
When I try to read then I get an error ''permission denied''

Maybe I am doing something wrong with the blocks code?
Where ever I read they say to authenticate before writing or sending, but how?
Authenticate once or every time before I send data and with which way/key to authenticate?

PS when I set rules of firebase to true then I can read and write

Thank you!

You canot use the native firebase component when authentication/secure rules are in place. There are no methods to handle them.

I am going to send you off here:

thanks for the link..

I have created the block to register but I cannot see any user being created in firebase.
When I paste the url from blocks to my browser with the API key then I can see my console and an empty directory /accounts:signUp

Also the articles says about saving the return values. Where can I find the return value?

Web1.GotText event will return the responseContent.

I have used the GotText and I received the following:
"append .json to your request URI to use REST API"

any idea what this is?

Also

This is form the tutorial

is this supposed to create a new user or get the info from an existing one? Because this is in the section "sign up user"

Hi @_rockingadget,
instead to use webcomponent use FirebaseManager Extension it easier

Best Regards
Marco

Hi Marco,

I tried to use the extension but it has been said that it cannot work with firebase rules.

Thanks I will give it a try and come back to you! :slight_smile:

From my guide:

image

Your blocks

image

are you surprised it does not work if you do not copy correctly ?

You mention in the post to use a dictionary in order to correctly set the dataToWrite.
Could you tell me where I can find that dictionary? Is data to write the TAG?

However I used your code and managed to register user but cannot write data.
Data path I used my firebase URL is that correct?

Id Token can I use the one I got back from response after sign up or should I refresh?

Thanks!

No!!
I just masked the entries with **** for privacy! In the actual code I have it correctly

Sorry I forgot to mention

I disagree

this (which is your firebase project url):
image

is nothing like this, which is a set part of the url, nothing to do with your firebase project url...

image

Hi, excuse me who said the Firebase manager extension cannot use the rules, it is absolutely wrong.
If You check, I use in my sample the same rules that You want to use for your project

Hi Marco,

No need to accuse anyone. I just read in some posts that the experimental component for firebase cannot be used with authorization rules etc.. Also while trying to use the component I could not access the database with rules other than READ, WRITE TRUE.

Can you please quide me how to set the field "data to write" correctly with the dictionary as you mention in your post about the component you made?
Also "data path" should be my firebase URL?

Thanks!

@Marco_Perrone

image

regarding path data
you join global project ID + global Uid +"/" + some text
so my question is

  1. if I dont want to write to a bucket "shopping list" then I leave this blank or just put my firebase url?
  2. is the Uid something you created to keep track of your list? If not then theUid should be the localid we receive from firebase?
  3. I just need to write a simple hello to database so I would know that it works!

PS

I have set up your shopping list example
I have registered user successfully
I try to add an item but lets me press the add item button only if I take a photo. When I take photo, enter the name and quantity I press add add item but I get warning "NOT FOUND"
Did I do something worng?
I initialised both storage and database and set the rules you provided

ps2

I have changed the block code and added my project id
I have created a bucket shoppinglist in the firebase, should I create one for firestore?

Regarding the screenshot I have changed the info in the second arrow but I cannot figure out what to put in the first arrow

@Marco_Perrone

I try to add an item but lets me press the add item button only if I take a photo. When I take photo, enter the name and quantity I press add add item but I get warning "NOT FOUND"
Could You write me your Storage URL?

Firebase (Realtime Database) and Firestore are different, the extension works with Realtime Database

In the image the url is wrong, You have to remove "gs://"

Hi!
ShoppingList (1).aia (164.7 KB)

Thanks for your response.. Let me send you my aia file. This time I inspected the required URLs etc and tried to enter the correct details.

I have changed the bucket to /images instead of /shoppinglist and for some reason I managed to upload a photo to firestore. But immediately I get an error after the block "gotPutData" is run saying: " 404 not found"
I dont get it. I have been staring the code for hours and I dont see where is the error. There shouldnt be an error since by the changes I made ( put correct projectID, entered a valid bucket) the app managed to upload a photo.

storage_bucket used

shoppinglist-c9e0d.appspot.com

"firebase_url":
https://shoppinglist-c9e0d-default-rtdb.firebaseio.com

you can try accessing this as well for test
/images/a.jpg
is an image I uploaded

Thanks

PS

Do you have any revolut account to buy you a "beer" or something? You have put a lot of time into this..

Hi @_rockingadget,
I think I found the problem is related to the url and my extension.
In the past the url Realtime database was only https://MYPROJECTID.firebaseio.com/
so I considered only the MYPROJECTID to create the url.
Now the url is more complex so I changed the extension to support this new url

try this sample if it works. Check your database and storage may be there is something to delete (I did some test)
ShoppingList.aia (165.8 KB)

Thank You
Best Regards
Marco