title: Google App Script API cannot authenticate "Request contains an invalid argument"
body: <p>I am pretty much using the sample from google's own site</p>
  
  <p><a href="https://developers.google.com/apps-script/api/how-tos/execute" rel="nofollow noreferrer">https://developers.google.com/apps-script/api/how-tos/execute</a></p>
  
  <p>The relevant part of the sample python script is replicated below</p>
  
  <pre><code>from __future__ import print_function
  from googleapiclient import errors
  from googleapiclient.discovery import build
  from httplib2 import Http
  from oauth2client import file as oauth_file, client, tools
  
  def main():
      """Runs the sample.
      """
      SCRIPT_ID = 'ENTER_YOUR_SCRIPT_ID_HERE'
  
      # Setup the Apps Script API
      SCOPES = 'https://www.googleapis.com/auth/script.projects'
      store = oauth_file.Storage('token.json')
      creds = store.get()
      if not creds or creds.invalid:
          flow = client.flow_from_clientsecrets('credentials.json', SCOPES)
          creds = tools.run_flow(flow, store)
      service = build('script', 'v1', http=creds.authorize(Http()))
  
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>I am getting the following error</p>
  
  <pre><code>  File "test.py", line 67, in &lt;module&gt;
      main()
    File "test.py", line 22, in main
      service = build('script', 'v1', http=creds.authorize(Http()))
    File "C:\Users\pedxs\Anaconda2\lib\site-packages\googleapiclient\_helpers.py", line 130, in positional_wrapper
      return wrapped(*args, **kwargs)
    File "C:\Users\pedxs\Anaconda2\lib\site-packages\googleapiclient\discovery.py", line 232, in build
      raise e
  googleapiclient.errors.HttpError: &lt;HttpError 400 when requesting https://www.googleapis.com/discovery/v1/apis/script/v1/rest returned "Request contains an invalid argument."&gt;
  </code></pre>
  
  <p>I had this exact code working just a week ago. line 22 uses the discovery build function, which as I understand is sending credentials to Google's API authenticator server "<a href="https://www.googleapis.com/discovery/v1/apis/script/v1/rest" rel="nofollow noreferrer">https://www.googleapis.com/discovery/v1/apis/script/v1/rest</a>". I am suspecting this is a problem on Google's side because even their sample code does not work.</p>
  
  <p>I have tried creating a new Google Cloud Platform and getting a new credentials.json file. I also tried authenticating with a different email account.</p>