I'm understanding this has to do with a timezone difference between the library and my server.
I set my PHP scripts to use UTC timezone. I'm really not sure how to fix this problem. There doesn't seem to be too much out there on the internet to fix the problem. I tried changing the leeway of JWT class and I'm still receiving problems. Code is posted below.
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'On');
date_default_timezone_set('UTC');
include "../../inc/dbinfo.inc";
require '../vendor/vendor/autoload.php';
use \Firebase\JWT\JWT;
JWT::$leeway = 60;
?>
Also I've tried:
JWT:$leeway += 60;
I am using an EC2 instance from Amazon Web Services. I am also using Firebase JWT api to produce the token.
EDIT: If i'm not providing enough information, please let me know. If there's a better way to produce JWT also let me know. I'm having a lot of issues with this library atm.
EDIT-----------------------------------------------------------------------------------------------------------------------------
Here is how I'm creating the token....
date_default_timezone_set('UTC');
use \Firebase\JWT\JWT;
$currentTimeInMillis = round(microtime(true) * 1000);
$token = array(
"iss" => "http://example.org",
"sub" => $username,
"iat" => $currentTimeInMillis,
"exp" => $currentTimeInMillis + 256000000);
$jwt = JWT::encode($token, $key);