I have found the answer.
The problem lies that the new version of firebase/php-jwt requires three arguments for the JWT::encode() method, while i am just putting two arguments there, therefor the token was not returned properly.
Originial JWT::encode
return JWT::encode($payload, self::$secret_key);
Update JWT::encode
return JWT::encode($payload, self::$secret_key, 'HS256');
Thank you for you time