Python 3.x 在firebase规则中,auth表示什么?
我试图暗示firebase中的规则,即每个登录用户都可以读取web应用程序上的任何数据。当我通过api登录用户时,我无法通过数据库读取任何信息。我正在使用pyrbase库。 这是我的密码:Python 3.x 在firebase规则中,auth表示什么?,python-3.x,firebase,firebase-realtime-database,firebase-authentication,firebase-security,Python 3.x,Firebase,Firebase Realtime Database,Firebase Authentication,Firebase Security,我试图暗示firebase中的规则,即每个登录用户都可以读取web应用程序上的任何数据。当我通过api登录用户时,我无法通过数据库读取任何信息。我正在使用pyrbase库。 这是我的密码: firebase = pyrebase.initialize_app(configS) auth=firebase.auth() db=firebase.database() email="varun@firebase.com" password="varun1" def createUser(data):
firebase = pyrebase.initialize_app(configS)
auth=firebase.auth()
db=firebase.database()
email="varun@firebase.com"
password="varun1"
def createUser(data):
user=auth.sign_in_with_email_and_password("admin@firebase.com","admin1")
# user=auth.create_user_with_email_and_password(email,password)
return db.child("users").child(user['localId']).set(data)
def loginUser():
return auth.sign_in_with_email_and_password(email,password)
def readData(branch):
user=loginUser(email,password)
return db.child(branch).get().val()
def writeData(branch,data):
user=loginUser(email,password)
return db.child(branch).push(data,user['idToken'])
results = createUser(dict(name="varun",phone="8787878787"))
# results=readData("responses")
# results=writeData("responses",dict(question="what?",answer="yes"))
print(results)
以下是我的规则:
{
"rules": {
".read":"auth!=null",
"responses":{
".write":"auth!=null"
}
}
}
以下是我的数据库结构:
{
"admin":{
"name": ()
"id": ()
}
"users":{
"user_id":
}
"responses":{
}
"surveys":{
}
}
请包含您遇到的错误消息或意外行为,并解释您的标题与问题的关系。我已解决此问题。我的用户正在进行身份验证。我没有使用代币。我现在已经包括在内了。谢谢