how to get custom google sign-in link in php symfony2

75 views Asked by At

I am trying to googlesign in with

Connect with Google+

after redirection in my system not able to get google id, email, etc information please help me out

follow code i am using but not working on me

 $gClient = new \Google_Client(array('client_id'=>'XX.apps.googleusercontent.com', 'client_secret' => 'XXXXXXXX'));

 if($_GET['code']) {

 $token = $gClient->fetchAccessTokenWithAuthCode($_GET['code']);
 $result = json_decode( $gClient->authorize('https://www.googleapis.com/oauth2/v1/userinfo' ), true );
 $message = 'Your unique Google user id is: ' . $result['id'] . ' and your name is ' . $result['name'];
    echo $message. "<br/>";
}

above code note working for me

0

There are 0 answers