Error comes on server.
This issue does not come on a local server, but when I will run this code on the server I will get an error every first time.
Here is my code and error message :
Message : Cannot handle token prior,"exception":"Firebase\JWT\BeforeValidException"
$client = new Google_Client(['client_id' => env('GOOGLE_CLIENT_ID')]);
$googlePayload = $client->verifyIdToken($token);
Thank you!
You probably have a slight skew between the clock on the server that mints the tokens and the clock on the server that's validating the token - if the iat or nbf is in the future, then the token isn't yet valid.
One solution would be to use a small leeway, like this:
JWT::$leeway = 5; // Allows a 5 second tolerance on timing checks
Duplicate of #1172
Most helpful comment
You probably have a slight skew between the clock on the server that mints the tokens and the clock on the server that's validating the token - if the iat or nbf is in the future, then the token isn't yet valid.
One solution would be to use a small leeway, like this: