title: Missing or insufficient permissions when writing to Firestore using field in access rules
body: <p>I am getting an error when attempting to write to Firestore.</p>
  
  <p>I am attempting to use a field containing the user uid for my security rule.</p>
  
  <pre><code>service cloud.firestore {
    match /databases/{database}/documents {
  
      match /messages/{document=**} {
        allow read: if resource.data.user_uid == request.auth.uid;
        allow write: if resource.data.user_uid == request.auth.uid;
      }
    }
  }
  </code></pre>
  
  <p>If I have data in my Firestore database, the read rule works fine - but when I attempt to write I get: <code>Error: Missing or insufficient permissions.</code>
  Is there something I'm doing wrong with this write rule?</p>
  
  <p>P.S. If I change my rule to this, I'm able to write to my database - but this isn't secure enough for my purposes:</p>
  
  <pre><code> match /messages/{document=**} {
        allow read: if resource.data.user_uid == request.auth.uid;
        allow write: if request.auth != null;
      }
  </code></pre>