Question

Can't find it

https://www.firebase.com/docs/security/rule-expressions/auth.html or https://www.firebase.com/docs/security/simple-login-email-password.html

And in security page i saw:

https://www.firebase.com/docs/security/security-rules.html

  "rules": {
    ".read": "auth.username == 'admin'",
    ".write": "auth.username == 'admin'"
  }

And i would like to use in one of my security rules the user 's name like:

  "something"
     "$name": {
        ".write": "$name == auth.name" 
      }

Is the auth.username available by default? If not how can i access it in firebase security.

BTW:(i have a field "name" in my users "table" )

Was it helpful?

Solution

For the email / password authentication method in Firebase Simple Login, the only attributes defined on the auth object in your security rules are the ones listed on https://www.firebase.com/docs/security/simple-login-email-password.html under the After Authenticating heading.

This includes the following:

  • provider - The authentication method used, in this case: password (string).
  • email - The user's email address (string).
  • id - The user's auto-incrementing id for your Firebase (string).
  • uid - A unique id combining the provider and id, intended as the unique key for user data (string).
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top