Google Login

Ask about a PHP problem here.
Post Reply
User avatar
FrederickGeek8
Posts: 148
Joined: Wed Nov 30, 2011 10:31 pm

Google Login

Post by FrederickGeek8 »

I want to extend my login system so that I can have users login/register with their Google Account. I am looking into the documentation and I was wondering if I could get some help with it. Do you know anyways of doing this?

Also I could do it myself if I knew a way to receive everything I needed via POST or something.

EDIT: I was able to figure it myself. I modified Google's "Google Plus PHP Starter". and wrote this snippet to get all user info needed
[syntax=php]$token = $client->getAccessToken();
$token = json_decode($token, true);
$token = $token['access_token'];
$info = json_decode(file_get_contents('https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token='.$token), true);[/syntax]
I still have yet to implement this into the login system, but I have everything I need.
Post Reply