Question

I try to authenticate into Google Queue API using the Google Sample Code - Taskqueue-cmdline-sample,

You have to set a google client id and google client secret into the client_secrets.json file of the sample.

So my problem is which credentials to use there and how to obtain them! Plus we have to use an email address in the ACL of queue.xml in GAE and not a Client ID...

You have a link in the documentation who point there to get the client id/secret: http://code.google.com/p/google-api-java-client/source/browse/shared/shared-sample-cmdline/src/main/java/com/google/api/services/samples/shared/cmdline/oauth2/OAuth2Native.java?repo=samples

But it's dead... (404) --> FIXED

Documentation: http://samples.google-api-java-client.googlecode.com/hg/taskqueue-cmdline-sample/instructions.html

Checkout the sample there : http://code.google.com/p/google-api-java-client/source/checkout

Update

The TaskQueue API is not in my list of Services. How could I activate TaskQueue API?

Was it helpful?

Solution

Thanks for the heads-up regarding the documentation. It was updated accordingly.

The credentials for client_secrets.json comes from the Developer Console. You can follow these steps to obtain them (which are now listed at the documentation):

  • Visit the Google apis console
  • If this is your first time, click "Create project..."
  • Otherwise, click on the drop down under the "Google apis" logo at the top left, and click "Create..." under "Other projects"
  • Click on "API Access", and then on "Create an OAuth 2.0 Client ID...".
  • Enter a product name and click "Next".
  • Select "Installed application" and click "Create client ID".
  • In the newly created "Client ID for installed applications", click "Download JSON" on the right side. Later on after you check out the sample project, you will copy this downloaded file (e.g. ~/Downloads/client_secrets.json) to src/main/resources/client_secrets.json. If you skip this step, when trying to run the sample you will get a 400 INVALID_CLIENT error in the browser.

Note that the link used above and in the documentation automatically asks if you want to activate the TaskQueue API, which is necessary. If you manually go to the API console, be sure to go to the services tab and turn that API on yourself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top