How to check Google token after login?

Viewed 22

I would like to know to retrieve token after login? I am using this code but retrieve an error

$idToken = 'xxxxxxx';

$auth = new Google\Auth\AccessToken();
$info = $auth->verify($idToken, [
  'certsLocation' => Google\Auth\AccessToken::IAP_CERT_URL,
  'throwException' => true,
]);

if ($audience != $info['aud'] ?? '') {
    throw new Exception(sprintf(
        'Audience %s did not match expected %s', $info['aud'], $audience
    ));
}

Here is the error I get

Fatal error: Uncaught RuntimeException: Please require kelvinmo/simplejwt ^0.2 to use this utility. in /home/admin/public_html/dsimlife.com/vendor/google/auth/src/AccessToken.php:412 Stack trace: #0 /home/admin/public_html/dsimlife.com/vendor/google/auth/src/AccessToken.php(196): Google\Auth\AccessToken->checkSimpleJwt() #1 /home/admin/public_html/dsimlife.com/vendor/google/auth/src/AccessToken.php(136): Google\Auth\AccessToken->verifyEs256(123, Array, NULL, NULL) #2 /home/admin/public_html/dsimlife.com/googlecheck.php(25): Google\Auth\AccessToken->verify(123, Array) #3 {main} thrown in /home/admin/public_html/dsimlife.com/vendor/google/auth/src/AccessToken.php on line 412

1 Answers
Related