Commit 01ca13e3 authored by okhin's avatar okhin 🚴

Adding the issued at claims, and remove 5 seconds to the not before (in case we have a clock skew)

parent 81d9122f
Pipeline #921 passed with stage
in 1 second
......@@ -70,7 +70,7 @@ class Main extends Controller {
elseif ($f3->get('VERB') == 'POST'){
// Create the call
// Generate a jwt token
$token = JWT::encode(array('api' => JWT_TOKEN, 'nbf' => time(), 'exp' => time() + 10 * 60), JWT_KEY);
$token = JWT::encode(array('api' => JWT_TOKEN, 'nbf' => time() - 5 , 'exp' => time() + 10 * 60, 'iat' => time()), JWT_KEY);
// To get the callee, we have the callee_id in the form. Using that
// to load the callee and retrieve its number.
$contact = Api::get_contact($args['id']);
......
......@@ -25,7 +25,7 @@ class SIP extends Controller {
);
$client = new GuzzleHttp\Client(['base_uri' => SIP_API]);
try {
$token = JWT::encode(array('api' => JWT_TOKEN), JWT_KEY);
$token = JWT::encode(array('api' => JWT_TOKEN, 'nbf' => time() - 5, 'exp' => time() + 10*60, 'iat' => time()), JWT_KEY);
$res = $client->get("calls/$call_id", ['query' => $data]);
$f3->set('response', (GuzzleHttp\Psr7\copy_to_string($res->getBody())));
} catch (RequestException $e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment