title: How do I stop PyDrive from auto-creating a new credentials.json file?
body: <p>I've been using PyDrive for Google Drive automation and it works perfectly locally. I plan to move the code to a remote shared machine, which would mean I'll need to move the secrets too. I am using LoadCredentialsFile and passing in credentials.json. I don't however think my issue is based on my own code, and rather the PyDrive code.</p>
  <p>In short: I want to trigger a function in the PyDrive module where it would usually fetch the client_secret and client_id from the credentials.json file. And this function will fetch the client_secret and client_id from vault instead. With this, I could then delete client_id and client_secret from credentials.json (for security reasons on the shared machine) and just fetch them and store in memory them when the python script executes.</p>
  <p>The problem I am having is this. I can delete the client_secret and client_id from the credentials.json file and hard code them under the PyDrive client.py class OAuth2Credentials(Credentials), under function from_json(), where it seems to be fetching the secrets from the json file. So instead of this inside that function:</p>
  <pre><code>data['access_token'],
              data['client_id'],
              data['client_secret'],
              data['refresh_token'],
  </code></pre>
  <p>I could instead do this (i have tried this and it works):</p>
  <pre><code>data['access_token'],
              &quot;myhardcodedclient_id.apps.googleusercontent.com&quot;,
              &quot;myhardcodedclient_secret&quot;,
              data['refresh_token'],
  </code></pre>
  <p>And then I could (haven't tried it yet) replace those hard coded values with functions to fetch the secrets from vault (hashicorp vault). Example:</p>
  <pre><code>data['access_token'],
              get_client_id(),
              get_client_secret(),
              data['refresh_token'],
  </code></pre>
  <p>The problem, however, is that when the script runs, it does use the hardcoded values, but it also overwrites the existing credentials.json file (with no secrets - because I manually deleted them) and inserts the hardcoded values into that json file, which then ruins the whole idea behind using vault (not wanting to expose client secret/id to other users on the remote machine.)</p>
  <p>Am I over complicating this? I would post the PyDrive code but there is 5000+ lines in the client.py file alone so I'm sure it would be spam and this isn't an issue with my own script (as that works perfectly as expected). If anyone has had experience doing something similar, please help! Thank you!</p>