title: Google Datastore authentication issue - C#
body: <p>I'm trying to connect to the Google Datastore on my account with service account credentials file (which I've created according to the documentation), but I'm encountering with authentication error while trying to insert an entity:</p>
  
  <blockquote>
    <p>Grpc.Core.RpcException: Status(StatusCode=Unauthenticated,
    Detail="Exception occured in metadata credentials plugin.")</p>
  </blockquote>
  
  <p>My code is:</p>
  
  <pre><code>var db = DatastoreDb.Create("myprojectid");
  Entity entity = new Entity{
   Key = db.CreateKeyFactory("mykindname").CreateIncompleteKey()
  };
  var keys = await db.InsertAsync(new[] { entity });
  </code></pre>
  
  <p>The <strong>GOOGLE_APPLICATION_CREDENTIALS</strong> variable refers to the credentials file and when calling GoogleCredential.GetApplicationDefaultAsync() to see if the credentials object is valid it indeed looks good...</p>
  
  <p>I saw some earlier examples which used the GetApplicationDefaultAsync function togehether with some DatastoreService object - but I couldn't find the <strong>DatastoreService</strong> object (probably it was there in old versions...) in the latest .Net API: <strong>Google.Cloud.Datastore.V1</strong></p>
  
  <p>Notice that I <strong>don't</strong> want to use the other authenticaiton methods:</p>
  
  <p>1) Using the gcloud cli.</p>
  
  <p>2) Running from Google environment (app engine for example).</p>
  
  <p>Any idea how to solve this?</p>