google-mirror-api

Call Google Glass Mirror API using service account


I need to create a (demo) application for Google Glass with a simple user interaction: insert a card on Glass and get a response back to the application. I think this can be done by using the Mirror API.

This application is not a web application so I think I need to use a service account.

I have created an API project on the Google APIs console https://code.google.com/apis/console/ and enabled the Google Mirror API. After that I created a new client ID with application type "service account" (calls Google APIs on behalf of your application instead of an end-user; more info at https://developers.google.com/accounts/docs/OAuth2#serviceaccount). The result is a client id, email address and public key fingerprint and a P12 key with password.

The problem is that I cannot find an example how to do the service account authentication and for example a card insert.

Any ideas? The used programming language is less important...

See also Can I use OAUTH2 Service Accounts with Glass Mirror API? but unfortunately without an answer.

Edit:

From the answer below I understand I cannot use the service account for this. Is it then correct that I always need a web application where Google Glass has a callback url so data can be send from Glass to the application?

We develop a Warehouse Management System where the operator in the warehouse uses a voice client (like http://www.epf-gmbh.de/bilderorg/talkman_joe.jpg) that communicates with the server. The server sends commands to the client and the operator can send voice commands back to the server.

For demo purposes I would like to replace the voice client with Google Glass.

Edit 2:

Something like this: http://youtu.be/kbcskj4yAvo


Solution

  • You cannot do timeline operations with a service account. Most Mirror API operations (on the Timeline, Contacts, and Subscriptions) require a user's account since these operations must be done on behalf of the user in order to correctly identify which Glass will be used.

    Update:

    Your followup questions don't exactly relate to the authentication question, and they may be better asked in a new question, but two quick points: