Hi all, I am trying to test if an email exists AND also check if an account name exists before a new account is created.
The user will sign up on via website, which is connected to our API to handle custom AUTH and our API connects to Firebase via REST. Then the user can use the APP to connect to firebase after registration.
The service is a SaaS structured as written below. I am not sure I have it structured right, but each Account can have 1 owner (which has to be unique between all accounts), multiple sub-users, multiple sub items, etc. No data is shared between accounts.
The question is, how can I check for an account name to see if it exists and the same for an email? Do I write this in an "rule" or is there a way I can query this via rest?
{
"accounts" : {
"-KG2B4SsRi_lm7ZJ5lhs" : {
"name" : "test",
"users" : {
"owner" : {
"-KG2B4cVVMijoHBjQi58" : true
}
}
},
"-KG2IMmYvtbn_UrzAHWx" : {
"name" : "test2",
"users" : {
"owner" : {
"-KG2IMuUYRaEKrjpk-04" : true
}
}
},
"-KG2INKnzUMmFhYhgfx_" : {
"name" : "test3",
"users" : {
"owner" : {
"-KG2INT1VpHKPU3Pr6lM" : true
}
}
}
},
"users" : {
"-KG2B4cVVMijoHBjQi58" : {
"account" : "-KG2B4SsRi_lm7ZJ5lhs",
"password" : "$2y$10$gBooXLNAi6mz2LjkHvuSGetP5ni4zDt2KFv3BjbqeBL.rwp255zHy",
"role" : "owner"
},
"-KG2IMuUYRaEKrjpk-04" : {
"account" : "-KG2IMmYvtbn_UrzAHWx",
"password" : "$2y$10$a/CC4MpXswSiIg4iXTeiGOkLzNJfX9Nf1qqq/qd40U6ANFvbM6uNm",
"role" : "owner"
},
"-KG2INT1VpHKPU3Pr6lM" : {
"account" : "-KG2INKnzUMmFhYhgfx_",
"password" : "$2y$10$WB2vtecthm1OdEYK0hzJZOMBvxoyiRnMXIwOMbFLmQZW3cRfULwDC",
"role" : "owner"
}
}
}