Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login Through Google Cannot handle token prior to timestamp #1543

Closed
elieobeid7 opened this issue Nov 7, 2018 · 2 comments
Closed

Login Through Google Cannot handle token prior to timestamp #1543

elieobeid7 opened this issue Nov 7, 2018 · 2 comments
Assignees
Labels
type: question Request for information or clarification. Not an issue.

Comments

@elieobeid7
Copy link

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

@mattwhisenhunt mattwhisenhunt added the type: question Request for information or clarification. Not an issue. label Nov 7, 2018
@mattwhisenhunt
Copy link
Contributor

Duplicate of #827

@mattwhisenhunt mattwhisenhunt marked this as a duplicate of #827 Nov 28, 2018
@mattwhisenhunt
Copy link
Contributor

mattwhisenhunt commented Nov 28, 2018

Please see the discussion there and in linked issues for help with your question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

2 participants