title: Ionic / Angular : Firebase Missing or insufficient permissions
body: <p>I have been using firestore for a while. Everything is fine with the database and the rules except for an entity, the collection is named &quot;Matches&quot;. On some items of this type (not all of them are concerned, which is even more disturbing), the user permissions do not seem to be sufficient:
  The rules are the following in firebase rules :</p>
  <pre><code>  match /Matches/{matchItem} {
          allow read, create: if isAuth(request);
          allow update, delete: if isOwner(resource.data.idUser);
    }
  
  
    function isAuth(request) {
        return request.auth != null;
    }
  
    function isOwner(idToCheck) {
        return request.auth.token.id_auth_user == idToCheck;
    }
  </code></pre>
  <p>Please note that i added a custom property (token.id_auth_user) to request.auth to avoid passing by the uid.</p>
  <p>The same user can however modify other items with exactly the same rules si i do not think the problem is comming from the isAuth(request) or the request.auth.token.id_auth_user. The idUser is filled in my object so i don't see where the problem can be. The idUser specified is the good id.</p>
  <p>Here is the structure of the object I want to modify :</p>
  <p><a href="https://i.stack.imgur.com/UyIv2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UyIv2.png" alt="enter image description here" /></a></p>
  <p>The call in my angular code is as follows:</p>
  <pre><code>    return this.afs.collection(&quot;Matches/&quot;).doc(match.id).update(match)
          .then()
          .catch((error) =&gt; {
          console.log(error);
      });
  </code></pre>
  <p>And i got this error in chrome console :</p>
  <blockquote>
  <p>FirebaseError: Missing or insufficient permissions.</p>
  </blockquote>
  <p>Does anyone have a way to avoid this error?</p>