/*Config Google Auth Starts*/

$base_url = "https://bestdivision.com/"
$client_id = '226822955667-4lsqoaayq3j577k9s1lv3j9660itlpdo.apps.googleusercontent.com';
$client_secret = 'rjkD7JSFMytBhhfzuuklx5gb';
$redirect_uri = $base_url.'do_login.php';

require_once 'google-api-php-client-2.4.0/vendor/autoload.php';

$client = new Google_Client();
$client->setClientId($client_id);
$client->setClientSecret($client_secret);
$client->setDeveloperKey($client_id);
$client->addScope("email");
$client->addScope("profile");
$client->setRedirectUri($redirect_uri);

/*Config Google Auth Ends*/

 

$login_url = $client->createAuthUrl();

 

<div onclick="window.location = '<?php echo $login_url ?>';"  name="google" ><svg width="30" aria-hidden="true" focusable="false" data-prefix="fab" data-icon="google" class="svg-inline--fa fa-google fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 488 512"><path fill="currentColor" d="M488 261.8C488 403.3 391.1 504 248 504 110.8 504 0 393.2 0 256S110.8 8 248 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9C258.5 52.6 94.3 116.6 94.3 256c0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9H248v-85.3h236.1c2.3 12.7 3.9 24.9 3.9 41.4z"></path></svg></div>

 

//do_login.php

if (isset($_GET['code'])) {
$token = $client->fetchAccessTokenWithAuthCode($_GET['code']);
print_r($token);
die();
}