At the end of the year, Parse will be closed, so I decided to start using Firebase. I need to implement a registration process with three fields: email, username, password ( Email and username must be unique for my application).
Since Firebase does not provide an easy way to manage a username, such as Parse, I decided to use only email / password registration and save some additional data, such as username. Here is my user data structure:
app : { users: { "some-user-uid": { email: "test@test.com" username: "myname" } } }
But I want to make a unique username and verify it before creating an account. These are my rules:
{ "rules": { ".read": true, ".write": true, "users": { "$uid": { ".write": "auth !== null && auth.uid === $uid", ".read": "auth !== null && auth.provider === 'password'", "username": {".validate": "!root.child('users').child(newData.child('username').val()).exists()"} } } } }
Many thanks for your help.
android firebase firebase-authentication firebase-security
FloGz Feb 06 '16 at 16:37 2016-02-06 16:37
source share