Skip to content

Commit

Permalink
Merge pull request #828 from google/issue-827-add-leeway
Browse files Browse the repository at this point in the history
adds 1-second leeway to JWT validation to prevent intermittent except…
  • Loading branch information
bshaffer committed Feb 5, 2016
2 parents c872f60 + 874faa4 commit bc39060
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Google/AccessToken/Verify.php
Expand Up @@ -189,10 +189,15 @@ private function getFederatedSignOnCerts()

private function getJwtService()
{
$jwtClass = 'JWT';
if (class_exists('\Firebase\JWT\JWT')) {
return new \Firebase\JWT\JWT;
$jwtClass = 'Firebase\JWT\JWT';
}

return new \JWT;
// adds 1 second to JWT leeway
// @see https://github.com/google/google-api-php-client/issues/827
$jwtClass::$leeway = 1;

return new $jwtClass;
}
}

0 comments on commit bc39060

Please sign in to comment.