18
Dec

My take on the Google+ PHP Quickstart with PHP Data

So, i've spent the past week or so getting my head around the new Google+ Signin code.

The 10 minute quickstart can be found Here. And while yes it does fancy javascripty things, it took me a while to figure out how to get what I wanted, which was the Google Profile data within PHP. The example does very well at javascript, but if you're looking for some sort of information within PHP that you can store to a database, or use against your existing login system, this quickstarter isn't the greatest of use.

So, this leads me on to getting frustrated, a lot. And getting a bit further, then getting frustrated again.

All I wanted was a unique ID, and an email address from Google so I could use these to authenticate an existing user in a system.
Could i find any documentation on this? Nope.
Most documentation leads somewhere along to https://developers.google.com/+/ or similar, or leads to the OAuth documentation.

Now the OAuth documentation was a great help Not!
I kept getting errors stating I was missing an origin, when after reading the class files, there was no way to set an origin. So anyway, I carried on getting annoyed and kept on trying.

Now, eventually I got there (which I guess you assumed, as I wouldn't want to post on here how I failed at understanding some sample code.. that wouldn't look too great)
And I got somewhere.

I even went to the lovely task of putting how far I got on github https://github.com/ganey/gplus-quickstart-php
I hope it's useful to some people as a starter for getting the information in PHP, rather than getting all bogged down in all the client side bits. The code will need modification, and securing, and shouldn't be use production as is. However it should provide a start for others to work from to get Google+ profile information in PHP which can be used however you want.