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
- check if provided username exists
- if not, use - firauth.auth()?.createuserwithemail, store username in db email, e.g.- users  - qzqfzwxpdmfc0xmyiq5idar1bzr2  - credentials  - email: "myemail@gmail.com"
- username: "myusername"
 
 
- credentials  
- rjasdfasfasdad3dadaewdsdkdq3dk  - credentials  - email: "another@gmail.com"
- username: ""another
 
 
- credentials  
 
- qzqfzwxpdmfc0xmyiq5idar1bzr2  
 
- users  
sign in
- query db user associated username , use email address , use firauth.auth()?.signin(withemail: withemaillog 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
Post a Comment