2025-06-26 14:09:25 +07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Controllers;
|
|
|
|
|
|
2025-09-19 16:42:27 +07:00
|
|
|
use CodeIgniter\API\ResponseTrait;
|
|
|
|
|
use CodeIgniter\Controller;
|
|
|
|
|
|
|
|
|
|
use Firebase\JWT\JWT;
|
|
|
|
|
use Firebase\JWT\Key;
|
|
|
|
|
use Firebase\JWT\ExpiredException;
|
|
|
|
|
use Firebase\JWT\SignatureInvalidException;
|
|
|
|
|
use Firebase\JWT\BeforeValidException;
|
|
|
|
|
use CodeIgniter\Cookie\Cookie;
|
|
|
|
|
|
2026-01-05 16:55:34 +07:00
|
|
|
class HomeController extends Controller {
|
2025-09-19 16:42:27 +07:00
|
|
|
use ResponseTrait;
|
|
|
|
|
|
|
|
|
|
public function index() {
|
|
|
|
|
|
|
|
|
|
// $token = $this->request->getCookie('token');
|
|
|
|
|
// $key = getenv('JWT_SECRET');
|
|
|
|
|
|
|
|
|
|
// // Decode Token dengan Key yg ada di .env
|
|
|
|
|
// $decodedPayload = JWT::decode($token, new Key($key, 'HS256'));
|
|
|
|
|
|
|
|
|
|
// return $this->respond([
|
|
|
|
|
// 'status' => 'success',
|
|
|
|
|
// 'code' => 200,
|
|
|
|
|
// 'message' => 'Authenticated',
|
|
|
|
|
// 'data' => $decodedPayload
|
|
|
|
|
// ], 200);
|
2025-06-26 14:09:25 +07:00
|
|
|
}
|
|
|
|
|
}
|