ios - Firebase permissions: Sign up with username and password -


i'd have users sign unique username , password (rather email + password). have working i:

sign up

  1. check if provided username exists
  2. if not, use firauth.auth()?.createuserwithemail , store username in db email, e.g.

    • users
      • qzqfzwxpdmfc0xmyiq5idar1bzr2
        • credentials
          • email: "myemail@gmail.com"
          • username: "myusername"
      • rjasdfasfasdad3dadaewdsdkdq3dk
        • credentials
          • email: "another@gmail.com"
          • username: ""another

sign in

  1. query db user associated username , use email address , use firauth.auth()?.signin(withemail: withemail log in

while approach work, i'm wondering how work firebase permissions?

in order email address associated username, i'm going have let all users access email address / username data, e.g.

{   "rules": {     ".read": true,     ".write": "auth != null"   } }  

does mean 'hacker' email addresses of users have registered app? if so, there way securely?

well answer question if can data if rules set true: yes, can query every user when registered. not unless testing. write database rules: firebase database can access every data , check unique name you. simple example:

{   "allusernames": {     ".read": false,     ".write": "!data.exists() && newdata.exists()"   } }  

when error in code, other words write failed, know username taken.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -