title: Authorization of Google Drive using JavaScript
body: <p>I'm trying to authorize my application to integrate with Google Drive. Google documentation provides details for server based authorization and code samples for <a href="https://developers.google.com/drive/credentials" rel="noreferrer">various server technologies</a>.</p>
  
  <p>There's also a <a href="https://code.google.com/p/google-api-javascript-client/" rel="noreferrer">JavaScript Google API library</a>, that has support for authorization. Down in the <a href="https://code.google.com/p/google-api-javascript-client/wiki/Samples" rel="noreferrer">samples section of the wiki</a> there is a code snippet for creating a config and calling the <a href="https://code.google.com/p/google-api-javascript-client/wiki/ReferenceDocs" rel="noreferrer">authorize function</a>. I've altered the scope to be that one I believe is required for drive:</p>
  
  <pre><code>var config = {
      'client_id': 'my_client_ID',
      'scope': 'https://www.googleapis.com/auth/drive.file'
    };
    gapi.auth.authorize(config, function() {
      console.log(gapi.auth);
    });
  </code></pre>
  
  <p>The callback function is never called (yes, the Google API library is loaded corrected) Looking the Java Retrieve and Use OAuth 2.0 Credentials example, the client secret seems to be a parameter, should this go into the config?</p>
  
  <p>Has anyone tried this in JS, for Drive or other Google APIs? Does anyone know the best route for debugging such a problem, i.e. do I need to just step through the library and stop whinging?</p>
  
  <p>Please don't suggest doing the authorization on the server side, our application is entirely client side, I don't want any state on the server (and I understand the token refresh issues this will cause). I am familiar with the API configuration in the Google console and I believe that and the drive SDK setting are correct.</p>