title: invalid_grant Error when Authenticating oauth Request - Google Drive
body: <p>I am attempting to get access to a customer's Google Drive to download their files. When testing the code on my own google drive, I am able to successfully download files. However, when I get the oauth code from them, I get the error:</p>
  
  <pre><code>oauth2client.client.FlowExchangeError: invalid_grant
  </code></pre>
  
  <p>After looking at some of the other answers, it has been suggested that you ensure access_type='offline', which seems to be the default and I can see in the generated url that this parameter is set. It also sounds like the code they give back may only be valid for an hour, however I have tried to use it within the hour and still no luck. Any other suggestions for how to avoid this problem?</p>
  
  <p>Here is the code I have been running:</p>
  
  <pre><code>from oauth2client import client
  import webbrowser
  
  flow = client.flow_from_clientsecrets(
    'client_secrets.json',
    scope='https://www.googleapis.com/auth/drive.readonly',
    redirect_uri='urn:ietf:wg:oauth:2.0:oob')
  
  auth_uri = flow.step1_get_authorize_url()
  webbrowser.open(auth_uri)
  
  print auth_uri
  
  auth_code = raw_input('Enter the auth code: ')
  
  credentials = flow.step2_exchange(auth_code)
  http_auth = credentials.authorize(httplib2.Http())
  </code></pre>
  
  <p>It errors on the flow.step2_exchange line.</p>