title: OAuth2 and Drive API, can't list/retrieve files
body: <p>I have a web application that needs to list all files from my Google Drive and then fetch them when clicked.
  I use OAuth for authenticating and it seems to work (the same code works well with Calendar API). I tried different scopes in serviceAccountScopes with no avail. </p>
  
  <p>Basically authentication is:</p>
  
  <pre><code>credential = new GoogleCredential.Builder().
  setTransport(HTTP_TRANSPORT).
  setJsonFactory(JSON_FACTORY).
  setServiceAccountId(apiEmail).
  setServiceAccountScopes(DriveScopes.DRIVE).
  setServiceAccountPrivateKeyFromP12File(p12File).build();
  
  credential.refreshToken();
  
  service = new Drive.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential).
  setApplicationName("My API").build();
  </code></pre>
  
  <p><strong>edit:</strong> I should Add that credential's accessToken is null before refreshToken() call. </p>
  
  <p>After that I try:</p>
  
  <pre><code>FileList files = service.files().list().execute();
  </code></pre>
  
  <p>The returned FileList is (should contain items):</p>
  
  <pre><code>{"etag":"\"_U9FTLXcHskmKgrWAZqJlfW8kCo/vyGp6PvFo4RvsFtPoIWeCReyIC8\"","items":[],"kind":"drive#fileList","selfLink":"https://www.googleapis.com/drive/v2/files"}
  </code></pre>
  
  <p>If I check that selfLink the contents is:</p>
  
  <pre><code>{
   "error": {
    "errors": [
     {
      "domain": "usageLimits",
      "reason": "dailyLimitExceededUnreg",
      "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
      "extendedHelp": "https://code.google.com/apis/console"
     }
    ],
    "code": 403,
    "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
   }
  }
  </code></pre>
  
  <p>Daily limit is not an issue here. (I guess this has nothing to do with this issue, since: <a href="https://stackoverflow.com/a/10639679/2090125">https://stackoverflow.com/a/10639679/2090125</a>). Also, I have enabled Drive and Drive SDK in Console (<a href="https://stackoverflow.com/a/10329353/2090125">https://stackoverflow.com/a/10329353/2090125</a>). </p>
  
  <p>When downloading a file this is performed:</p>
  
  <pre><code>File file = service.files().get(fileId).execute();
  </code></pre>
  
  <p>And it produces this (fileId exists):</p>
  
  <pre><code>An error occured: com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found
  {
    "code" : 404,
    "errors" : [ {
      "domain" : "global",
      "message" : "File not found: 0B97KF40kTwrTaTllMnZCTV9ZSnM",
      "reason" : "notFound"
    } ],
    "message" : "File not found: 0B97KF40kTwrTaTllMnZCTV9ZSnM"
  }
  </code></pre>
  
  <p>And again when checking <a href="https://www.googleapis.com/drive/v2/files/0B97KF40kTwrTaTllMnZCTV9ZSnM" rel="nofollow noreferrer">https://www.googleapis.com/drive/v2/files/0B97KF40kTwrTaTllMnZCTV9ZSnM</a> the same "dailyLimitExceededUnreg" is seen.</p>
  
  <p>What is going on here, is there a problem in my authentication? Should I configure Drive Integration in Drive SDK somehow? From Googles documentation I have understood that it's not necessary and the methods I'm using should work without further configuring. </p>