0

I'm trying to create a php page which will authenticate using a service account and will create a new timeline card for the application users.

(It's working using a client ID for web sites)

So I have created a service account, uploaded the key.p12 file to the server and I keep getting this error message:

Uncaught exception 'Google_Auth_Exception' with message 'Error refreshing the OAuth2 token, message: '{ "error" : "invalid_grant" }''

As I understood I also need to give access to the service user (the email address generated) in my app (I saw an example where this is how its done with Google Analytics) but where can I do it with the mirror service / my google glass application?

Basic question is: How do I authenticate with mirror using a service account.

Thank you!

MWiesner
  • 8,868
  • 11
  • 36
  • 70
Doron Goldberg
  • 643
  • 1
  • 9
  • 23
  • A service account isn't authenticated that's what its for and it probably doesn't have a glass time line. In order to write to a users timeline they must give you access to do that using OAUTH2. – Linda Lawton - DaImTo Aug 05 '14 at 13:57
  • So what can I do if I want to allow external applications to push notifications to users? I need them to post the data to the .php file. – Doron Goldberg Aug 05 '14 at 13:59
  • First you need to ask your user to authenticate your application via Oauth2, then your application will be allowed to write data to there Glass timeline. Its your own application that has permission to write to it then , no other external application will be allowed to write to it unless they are also authenticated. – Linda Lawton - DaImTo Aug 05 '14 at 14:02
  • hmmm, depending upon what these external applications are I guess you could set them up to post to the php application but why not just set up the external applications to do it themselves? More info on what your doing might help – Linda Lawton - DaImTo Aug 05 '14 at 14:03
  • I have the php example for mirror API configured and installed on my server and it works fine from the browser. I added my own php file which gets the card parameters from the request (text, location etc) - this file works as well when called from my browser since I'm logged in. I want an external server (not running php) to call this page so it will push the card into the users glasses - I'm trying to set it to use a service account since the request from the server doesn't and won't have the credentials. What I'm looking for is php server side authentocation with mirror / glass. – Doron Goldberg Aug 05 '14 at 14:40

0 Answers0