I'm trying to make a server application to routinely pull Google Analytics data from my own GA account. Note, it is a personal, server-side application accessing my own data, i.e. there is no end-user accessing this application.
As such, I registered my application in the Google API Console as a Service Application, which gave me a Client ID and a Private Key. It is my understanding that Service Applications do NOT use Application Secret and Redirect URL as there is no end-user in this server-to-server authentication flow. Indeed, the Google API Console gave me no Secret and did not prompt me for a Redirect URL.
Unfortunately, I can not figure out how to authenticate my Service Application within Google's PHP Client API. While there is extensive documentation on authenticating web applications with an end-user, there doesn't seem to be anything explaining service apps without and end-user.
Google's documentation suggests it is possible to authenticate server-to-server by signing a JWT request with the private key. I just can't figure out how to do within the PHP client API (although I've browsed the source and there's definitely a script that signs a request with the private key.)
Am I missing something here? How can I perform authentication for a Service Application with my private key and the Google PHP client API?
Thanks, all!
Also posted on StackOverflow
You're a lifesaver. Thanks a million!
On Monday, March 26, 2012 12:38:29 PM UTC-4, Chirag Shah wrote:
Hey Reece,I'm happy to announce that the Google API PHP Client now supports service accounts on trunk!The implementation hasn't been released yet, so you'll need to checkout the latest version of the PHP client by visiting:I've prepared a sample application that demonstrates how you can use service accounts to hit the Google Prediction API.To view the example, take a peek at examples/prediction/serviceAccount.php or visit:If you happen to find a bug, please let us know by filing a bug here:Thank you!Chirag Shah