Skip to content
Snippets Groups Projects

OneHundred - 13515005 - Husnulzaki Wibisono Haryadi

Compare and
79 files
+ 3976
98
Preferences
Compare changes
Files
79
+ 35
0
<?php
namespace controller\auth;
require_once '../vendor/autoload.php';
use \Firebase\JWT\JWT;
class TokenController {
private $key = "secret";
private $expTime = "24h";
public static generateToken($email) {
$payload = array(
"email" => $email,
"loginTime" => "20/02/2019 10:00:00",
"expiresIn" => $expTime
);
$jwt = JWT::encode($payload, $key);
return $jwt;
}
public static verifyToken($email, $token) {
}
}
//$decoded = JWT::decode($jwt, $key, array('HS256'));
//print_r($decoded);
/*
NOTE: This will now be an object instead of an associative array. To get
an associative array, you will need to cast it as such:
*/
//$decoded_array = (array) $decoded;
?>
\ No newline at end of file