Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70764

Firebase rules and permissions

$
0
0

@joker84a wrote:

Hi

I’m tring to setup a realtime database with firebase. I’m getting problems about the rules. I wrote this simple rules:

service cloud.firestore {
  match /databases/{database}/documents {
    match /players/{playerId}  {
     allow read, write: if request.auth.uid == playerId;
    }
  }
}

And this is my method to auth the user with sms:

firebase.auth()
                 .signInWithPhoneNumber(phoneNumberString, appVerifier)
                 .then(confirmationResult => {
                  // other code and wait user to insert the code and send it with an action listener on a button
                  firebase.auth().onAuthStateChanged((user) => {
                                    if (user) {
                                         // here I write a user in my db
                                    }
                  });
        });

But after the user insert the right code sent by firebase, and he is authenticated, firebase return me he has not the right permission to write.

How should I fix it to make it works, because I’m not figure out and online I didn’t find anything that could help me.

Thanks

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70764

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>