HEX
Server: Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10
System: Windows NT ALTAIR 10.0 build 20348 (Windows Server 2022) AMD64
User: Administrator (0)
PHP: 8.1.10
Disabled: NONE
Upload Files
File: C:/laragon/www/beplocal/refreshJwt.php
<?php
require "vendor/autoload.php";
include_once 'DBClassOkta.php';
use \Firebase\JWT\JWT;

$oldJwt = $_POST['jwt'];
$secret_key = "OKTA2022@2202ATKO"; 

try { 
		$decoded = JWT::decode($oldJwt, $secret_key, array('HS256'));
		$user = $decoded->data->Login;
		$nome = $decoded->data->Nome;
		$cognome = $decoded->data->Cognome;

		
			
			$issuer_claim = "THE_ISSUER"; 
			$audience_claim = "THE_AUDIENCE";
			$issuedat_claim = time(); 
			$notbefore_claim = $issuedat_claim ; 
			$expire_claim = $issuedat_claim + 1800; 
			$token = array(
            "iss" => $issuer_claim,
            "aud" => $audience_claim,
            "iat" => $issuedat_claim,
            "nbf" => $notbefore_claim,
            "exp" => $expire_claim,
            "data" => array(
                "Cognome" => $cognome,
                "Nome" => $nome,
                "Login" => $user
        ));



        $jwt = JWT::encode($token, $secret_key);
		
         echo json_encode(
            array(
                "message" => "Token aggiornato con successo ",
                "jwt" => $jwt
  
            ));

		die();
				
		
	}
			

	catch (Exception $e) { 
	
		echo json_encode(array( 
			"message" => "SESSIONE SCADUTA",
			 "jwt" => $oldJwt
			
		)); 
	}
?>