Firebase security error token expire

Hi koders

i try to secure Firebase with this rules

{
“rules”: {
“users”: {
“$uid”: {
“.read”: “$uid === auth.uid”,
“.write”: “$uid === auth.uid”
}
}

Use this block

blocks(14) blocks(13) blocks(12)

so that to me it appears random this error comes out

where am i wrong?

Thank for answer

Can i put rule with users/uid?

No not like that. Refer this post/guide

I already read the guide and i try to make block same but not function

Show me your rule now

{
“rules”: {
“users":{
“$user ID:
.
.
.
Sorry

After settling rule you can check up there itself

{
“rules”: {
“users”: {
“$uid”: {
“.read”: “$uid === auth.uid”,
“.write”: “$uid === auth.uid”
}
}

excuse me
I do not have
I got it

Don’t use uid , if you want then change the global variable name from user ID to uid

Also confirm me, while you creating project in firebase which server you gave? US states or anyother server?

US server only will work without problem for firebase authendication

the server is usa

now i rewrite rule in

{
“rules”: {
“users”: {
“$user_id”: {
“.read”: “$user_id === auth.uid”,
“.write”: “$user_id === auth.uid”
}
},
“Blue”: {
“.read”: true,
“.write”: true
}
}
}

but also error

Still it is working with no problem in my app

the problem that works and then without explanation stops working

It’s probably because database component works on a custom token system. Try to set Firebase Token at user succes as in login succes. So everytime user open the app fetch the token and return it to firebase database token.

I tried the problem I think it is that if the app remains open for more than an hour it expires, can you intercept the error, prevent it from appearing and renew the token?

On firebase database error try to fetch the token ID again an set your firebase database token to it.

yes I thought of doing so but can I avoid the error appearing by intercepting before it appears?

Just Write True in Both Read/Write

thanks for the great advice :joy: :joy: :joy: