2
votes

In the new version of Firebase, (https://firebase.google.com/docs/reference/js/firebase.auth.Auth) I am looking for a method to set {admin:true,debug:true} in order to get admin access and debug mode to register all actions in the browser log. I know in the previous version that worked (https://www.firebase.com/docs/web/guide/login/custom.html#section-tokens-without-helpers), but in the new version I dont know if it is achieveable.

1

1 Answers

0
votes

As far as I know you can't assign a "debug" key to your custom Auth Token, in order to have details about your write/read operations' information.

The new FirebaseDatabase framework offers some logging info with :

FIRDatabase.setLoggingEnabled(true) // Swift code

But if you ever meet a write error for example, there won't be any details about which rule is failing :

Got data message: {
b =     {
    d = "Permission denied";
    s = "permission_denied";
};
    r = 4;
} 

So if you're like me and want to test your rules, the last way to do this is by going to your Firebase console, then in your project go to Database section, under Rules tab you will be able to simulates reads or writes to your database with some comprehensive result details. So you can get this kind of error :

V Ligne 80 (/myNode)
  validate: "newData.hasChildren() && newData.hasChildren(['myChild'])"
X Line 82 (/myNode/myNumber)
  validate: "newData.isNumber()"