Google App Engine Task Queue REST API for the Java Development Server (devserver)
<p>I have a GAE app running on the Java Development Server (AKA devserver) on my local machine that defines some Task Queue pull queues.</p>

<p>I want to use the Task Queue REST API from a different standalone Java app, running on my machine, to access these pull queues.</p>

<p>I tried <a href="https://github.com/google/google-api-java-client-samples/tree/master/taskqueue-cmdline-sample" rel="nofollow">the sample</a> suggested by Google's <a href="https://cloud.google.com/appengine/docs/java/taskqueue/rest/libraries" rel="nofollow">documentation</a> that implements leasing tasks. Apparently, it uses the <a href="https://developers.google.com/api-client-library/java/" rel="nofollow">Google API Client Library for Java</a> that requires a <code>client_secrets.json</code> file of the format:</p>

<pre><code>{
  "installed": {
    "client_id": "retrieved from creating a Service Account for the project",
    "client_secret": "supposedly appears in the JSON file that's downloaded upon creation of a Service Account for the project"
  }
}
</code></pre>

<p>I created a Service Account for the project and a JSON was automatically downloaded, with the following format:</p>

<pre><code>{
  "type": "service_account",
  "project_id": "myProjectId",
  "private_key_id": "some long hexadecimal",
  "private_key": "an even longer encrypted stuff",
  "client_email": "myServiceAccountName@myProjectId.iam.gserviceaccount.com",
  "client_id": "a decimal number",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://accounts.google.com/o/oauth2/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/myServiceAccountName%40myProjectId.iam.gserviceaccount.com"
}
</code></pre>

<p>In my <code>client_secrets.json</code> file I used <code>private_key_id</code> as the <code>client_secret</code> value and executed the sample code.</p>

<p>The result was that it opened <code>https://accounts.google.com/o/oauth2/auth</code> in my browser, which displayed an error with status code <code>400</code> and the following message:</p>

<blockquote>
  <p>Error: redirect_uri_mismatch Application: My Application The redirect
  URI in the request: <a href="http://localhost:61130/Callback" rel="nofollow">http://localhost:61130/Callback</a> did not match a
  registered redirect URI.</p>
</blockquote>

<p>I tried <code>Taskqueue.Builder.setRootUrl("http://localhost:8080")</code>, although its javadoc says not to mess with it. It returned <code>401 Unauthorized</code>.</p>

<ol>
<li>Is there a way to use the Task Queue REST API from a standalone Java app to access these pull queues? I prefer using the Java libraries offered by Google but apparently they automatically point to the actual GAE services.</li>
<li>What should I use as the value of <code>client_secret</code><sup>1</sup> in the <code>client_secrets.json</code> file when I do want to lease tasks from Google App Engine on the cloud?</li>
</ol>

<hr>

<p><sup><sup>1</sup> When I created the Service Account, since I'm not the owner of the project, I got the following message:</sup></p>

<blockquote>
  <p><sup>The service account could not be added to this project's permissions
  because you are not an owner of the project. To give the service
  account access to this project, ask a project owner to add it to the
  project permissions.</sup></p>
</blockquote>

<p><sup>I wonder whether this has something to do with the absence of a <code>client_secret</code> property in the automatically downloaded JSON.</sup></p>