title: FireStore permission denied on basic requests Xamarin Forms
body: <p>I have been struggling with this problem for a few days now and I am not making much progress, any help would be appreciated.  I am new to FireStore but really like the possibilities it offers.  I have successfully managed to get basic documents from Android and iOS apps using Plugin.CloudFirestore and Xamarin.Forms.  </p>
  
  <p>However I need some back-end services, things like data set-up etc and need to be able to connect to FireStore via regular old C# desktop app.  So I followed the quick start guide, Nuget'ed Google.Cloud.Firestore, set the environment variable and no matter how I try the code I get "PERMISSION_DENIED: Missing or insufficient permissions."</p>
  
  <p>Some details, I am using a service account set with Project Owner permissions and have not changed the default access rules yet.  I know the environment variable is set-up correctly and the file is found.  All packages are most recent.  Frustrating that my iOS/Android apps are working, but this is not, I expected more issues with the mobile apps.  As I am still exploring all this is just in a unit test so I can execute and change the code pretty quickly.</p>
  
  <p>Help would be really appreciated before I start banging my head on the desk :-)</p>
  
  <pre><code>[TestClass]
  public class UnitTest1
  {
      [TestMethod]
      public void TestMethod1()
      {
          Task&lt;string&gt; task = Task.Run&lt;string&gt;(async () =&gt; await GetUserName());
          var x = task.Result;
          return ;
  
      }
  
      private async Task&lt;string&gt; GetUserName()
      {
          string projectId = "matchesJson";
          FirestoreDb db = FirestoreDb.Create(projectId);
          string retVal = "";
  
          try
          {
              CollectionReference col = db.Collection("users");
              // Exception thrown on next line
              QuerySnapshot snapshot = await col.GetSnapshotAsync();
              // get some data
              retVal = "";
          }
          catch (Exception e)
          {
              retVal =  e.Message;
          }
          return retVal;
      }
  
  }
  </code></pre>
  
  <p>---- EDIT ADDING RULE -------
  -- Today is March 3nd 2020 --</p>
  
  <pre><code>rules_version = '2';
  service cloud.firestore {
    match /databases/{database}/documents {
      // This rule allows anyone on the internet to view, edit, and delete
      // all data in your Firestore database. It is useful for getting
      // started, but it is configured to expire after 30 days because it
      // leaves your app open to attackers. At that time, all client
      // requests to your Firestore database will be denied.
      //
      // Make sure to write security rules for your app before that time, or else
      // your app will lose access to your Firestore database
      match /{document=**} {
        allow read, write: if request.time &lt; timestamp.date(2020, 3, 28);
      }
    }
  }
  </code></pre>