i don't save user's data in firebase only data that everyone can access but i would like only authenticated users
Been having a think....
-
There is no point trying to test "no rules" with a token, it won't make any difference either way.
-
You should set your rules to:
{
"rules": {
".read": "auth.uid != null",
".write": "auth.uid != null"
}
}
or
{
"rules": {
".read": "auth != null",
".write":"auth != null"
}
}
or
{
"rules": {
"datizme": {
".read": "auth.uid != null",
".write": "auth.uid != null"
}
}
}
which will give all authenticated users read/write accordingly.
- Make sure that your user's token has not expired. It is not easy to use the refresh token with the REST api, but it can be done, so set a timer, or record the login time, when your user logs in, and check it has not gone past an hour when your user is sending/fetching data. If an hour has passed then log them in again / get them to login again
hi
it's getting late and I have to thank once again a certain Metric Rat because thanks to this generous post
it works with the rules defined for authenticated users,
on the other hand I would like to ask him if I can generate such a structure with a single put
the parent node id given by the textbox
1 item1
item2
item3
itemx
1 is the parent node
item1, item2, item3, itemx are child node
there is a loop but I see no further
I could do it with the firebase blocks
Do you mean like this?
I tried this form of request but it didn't work
I only need the names of the child nodes that I will complete later
i think i can't do that
Looks like you are trying to set nodes without values, this won't work (just try it in the firebase console manually and you will see. You need to give each end node a value -
{"itemx":0}
Probably something like this:
BLOCKS
FIREBASE DATA
After doing this you will have to work with each end node individually, so if you want to change the value for user4
BLOCKS
otherwise you will wipe everything in the Users node
All this tested with the rules:
{
"rules": {
".read": "auth != null",
".write":"auth != null"
}
}
and an authenticated user...
Here is a slightly neater way to do it, using dictionaries
For what it is worth, tested authenticated user when rules are true, true. This also works. Make sure you refresh/renew your user token before trying.
Also works with these rules:
{
"rules": {
".read": "auth.uid != null",
".write":"auth.uid != null"
}
}
where I am ?
I created a timer that I activate when the user connects and every hour I generate an idToken as you suggested to me the user is connected while he is in the app. which should happen
you offered me a different dictionary-based solution but it does so much to digest ...
my database is probably poorly designed hoping that I would do better another time
I made a mistake by creating an empty node and in the original version it was not empty
how i can generate this
1
item1
item1
item2
item2
item3
item3
I tried with a put that I placed in a loop but I get lost between what is string and what is variable
You can't have two nodes with the same name at the same level, they will just overwrite each other.
Here blocks that create individually named nodes:
it's because I'm trying to indent
the initial content of each node
1
item1
item: 1
item2
item: 2
item3
item: 3
Like this?:
1
- item1
- item:1
- item2
- item:2
- item3
- item:3
absolutely
I do not master the tools of the forum among other things
This means that I have to discover dictionaries to understand and it is probably necessary because I was wondering how to record a series of data with a put it would be the method to use?
a big thank-you
The dictionary blocks are useful in making the JSON strings, you will have seen how I did this manually earlier in the topic.
I believe this might be a good method for setting up a structure, but perhaps not the best way to create and update data within that structure.
it is true that we are very far from authentication but in my application before using idToken I saved with extended posts where I chained the data with & or loops on firebase backup blocks ...
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.