Login Through Google Cannot handle token prior to timestamp

509 views Asked by At

My php

<?php require

    "vendor/autoload.php";
//Step 1: Enter you google account credentials

$http     = new GuzzleHttp\Client(['verify' => 'cacert.pem']);
$g_client = new Google_Client();
$g_client->setHttpClient($http);

$g_client->setClientId("");
$g_client->setClientSecret("");
$g_client->setRedirectUri("http://localhost:8000");
$g_client->setScopes(Google_Service_PeopleService::USERINFO_PROFILE, Google_Service_PeopleService::USER_EMAILS_READ);

//Step 2 : Create the url
$auth_url = $g_client->createAuthUrl();
echo "<a href='$auth_url'>Login Through Google </a>";

//Step 3 : Get the authorization  code
$code = isset($_GET['code']) ? $_GET['code'] : null;

//Step 4: Get access token
if (isset($code)) {

    try {

        $token = $g_client->fetchAccessTokenWithAuthCode($code);
        $g_client->setAccessToken($token);

    } catch (Exception $e) {
        echo $e->getMessage();
    }

    try {
        $pay_load = $g_client->verifyIdToken();

    } catch (Exception $e) {
        echo $e->getMessage();
    }

} else {
    $pay_load = null;
}
echo '<pre>';
print_r($pay_load);
echo '</pre>';

The error

Login Through Google Cannot handle token prior to 2018-11-07T05:25:08+0200


Notice:  Undefined variable: pay_load in C:\Users\user-pc\Desktop\g\google.php on line 45

I tried adding JWT::$leeway = 5 I get undefined variable. 20 minutes ago everything was working. I'm using the php built in web server, the time should be correct

0

There are 0 answers