简体   繁体   English

读写权限被拒绝的Firebase

[英]Read Write Permission Denied Firebase

I am developing an app, I had my security rules setup. 我正在开发一个应用程序,我已经设置了安全规则。 I was able to read and write in my firebase ref but today suddenly it's saying permission denied for everything. 我能够在我的Firebase参考中进行读写,但是今天突然间,它说所有内容都被拒绝允许。

Rules: 规则:

{
"rules":{
  "users":{
    "$uid":{
        ".read": "auth != null && auth.uid == $uid",
        ".write": "auth != null && auth.uid == $uid"
      }
    }
  }
}

I thought I might have accidentally changed something in the rules but I removed the read write auth and uid check and even then it wasn't working. 我以为我可能不小心更改了规则中的某些内容,但是我删除了读写身份验证和uid检查,即使这样也无法正常工作。

I'm guessing it has something to do with login session. 我猜它与登录会话有关。 How do I know if my session is still active? 我如何知道我的会话是否仍在进行中? Because in my activity I can get the auth object and it's not null. 因为在我的活动中我可以获取auth对象,但它不是null。 It even has uid, token etc etc. 它甚至具有uid,token等。

Also, in firebase auth settings, the default session length is 24 hours. 此外,在firebase身份验证设置中,默认会话时长为24小时。 Is it also applicable for email login type authentication? 它也适用于电子邮件登录类型身份验证吗?

Would I have to make my users login every 24 hours. 我是否必须让我的用户每24小时登录一次。

As you stated in your question your default session length is 24 hours. 如您在问题中所述,您的默认会话时长为24小时。 This means after those 24 hours the session expires and the user has to login again. 这意味着在这24小时之后,会话将终止,用户必须再次登录。

To prevent this you can change the default session length in your firebase dashboard. 为防止这种情况,您可以在Firebase仪表板中更改默认会话长度。

Also take a look at the documentation . 另请参阅文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM