title: Invalid Credentials for Google Drive API
body: <p>This weekend I started a new project that involved the Google Drive API. I was able to query the Files and Permissions resources successfully using a service account.</p>
  <p>Then on Monday, without making any changes to my code, I started getting 401 <strong>Invalid Credentials</strong> on every request. I am still able to query the Admin SDK API with the same service account credentials.</p>
  <p>I'm using the Python Google API client. I made sure to include all the scopes listed in the API documentation in my request in Python. I have granted domain wide delegation to the service account along with all the necessary scopes.</p>
  <p>I get the same error if I use a service account or if I use <code>OAuth 2.0</code> and use an admin user to grant authorization. I even get the error when I use the API explorer on the documentation page (<a href="https://developers.google.com/drive/api/v3/reference/files/list" rel="nofollow noreferrer">https://developers.google.com/drive/api/v3/reference/files/list</a> for example). This is the response I repeatedly get:</p>
  <pre><code>{
   &quot;error&quot;: {
    &quot;errors&quot;: [
     {
      &quot;domain&quot;: &quot;global&quot;,
      &quot;reason&quot;: &quot;authError&quot;,
      &quot;message&quot;: &quot;Invalid Credentials&quot;,
      &quot;locationType&quot;: &quot;header&quot;,
      &quot;location&quot;: &quot;Authorization&quot;
     }
    ],
    &quot;code&quot;: 401,
    &quot;message&quot;: &quot;Invalid Credentials&quot;
   }
  }
  </code></pre>
  <p>Any ideas for other approaches I can try to get this working?</p>