1

Assuming a simple data structure:

-root
 -uid
  name:string
 -uid2
  name:string

Is there a way on firebase side(server) to restrict the unique name?

I've seen some solutions like to store names on another node. The problem would be the store action is actually carried out on client side. It is still easy for a registered user to bypass the checking.

Thanks!

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Phil Li
  • 323
  • 1
  • 2
  • 8
  • 2
    There is no way to ensure unique **values** within a list. But **keys** on the other hand are guaranteed to be unique within their context. That's why all solutions you find will swap the values you want into keys. This approach works and is used by many Firebase developers. If you're having problems making this work securely, share the [minimal code that reproduces the problem](http://stackoverflow.com/help/mcve). – Frank van Puffelen Feb 04 '17 at 15:25
  • See http://stackoverflow.com/questions/39149216/firebase-security-rules-to-check-unique-value-of-a-child-askfirebase and http://stackoverflow.com/questions/25294478/how-do-you-prevent-duplicate-user-properties-in-firebase – Frank van Puffelen Feb 04 '17 at 15:28

0 Answers0