title: Getting Error: unauthorized_client when trying to authorize script
body: <p>I've created service account with domain wide delegation and its scopes (in Admin console and Developer console) as described in documentation. I've been trying this for a week now and I am stuck. This is my code:</p>
  
  <pre><code>const google = require('googleapis');
  const gmail = google.gmail('v1');
  const directory = google.admin('directory_v1');
  const scopes = [
    'https://www.googleapis.com/auth/gmail.readonly',
    'https://www.googleapis.com/auth/admin.directory.user.readonly'
  ];
  const key = require('./service_key.json');
  
  var authClient = new google.auth.JWT(
    key.client_email,
    key,
    key.private_key,
    scopes,
    "kruno@example.com"
  );
  
  authClient.authorize(function(err, tokens){
    if (err) {
      console.log(err);
      return;
    }
  
  // API call methods here...
  
  });
  </code></pre>
  
  <p>I get this error: </p>
  
  <blockquote>
    <p>Error: unauthorized_client</p>
  </blockquote>
  
  <p>I am unable to understand:</p>
  
  <ul>
  <li>Is this proper technique for calling Google API methods from server-side scripts without any user interaction? (under domain only)</li>
  <li>How do service account and actual user account communicate this way?</li>
  <li>I heard about callback URI, am I missing it?</li>
  </ul>