Help to stop time syncing

Description
If my server time is not matching exactly with the current time then Web SDK is not allowing to join a meeting. If the difference is of minute then also having an issue.

Can you please me to stop comparing time zone/ time by anyway?

Which version?
1.8.6

Hi @dipapatra2012,

I believe your server needs to use the correct time, since the signature would be out of date otherwise.

Thanks,
Alex

1 Like

Hey @dipapatra2012,

Thank you for reaching out. @alexmayo is correct, you will need to make sure that your server is synced with the UTC timezone in order to avoid signature expiration issues.

Let me know if you have any questions.

Thanks,
Max

1 Like

@MaxM Is there anyway to make it working even though the server isn’t in sync?

Hey @dipapatra2012 ,

Is your server not in UTC time?

Thanks,
Tommy

The Zoom signature uses UTC as a timestamp origin, therefore if you’re running another timezone, PHP’s time() function will return an incorrect time.

You can get around this using the date_default_timezone_set() function, which sets the timezone for the remainder of the PHP script.

function generate_signature ( $api_key, $api_secret, $meeting_number, $role){

    //Set the timezone to UTC
    date_default_timezone_set("UTC");

    //Time in milliseconds (or close enough)
    $time = time() * 1000 - 30000;
	
    $data = base64_encode($api_key . $meeting_number . $time . $role);
	
    $hash = hash_hmac('sha256', $data, $api_secret, true);
	
    $_sig = $api_key . "." . $meeting_number . "." . $time . "." . $role . "." . base64_encode($hash);
	
    // Return signature, url safe base64 encoded
    return rtrim(strtr(base64_encode($_sig), '+/', '-_'), '=');
}

@tommy, I’m wondering it it’s worth adding the date_default_timezone_set("UTC"); line to the documentation, in case anyone else’s server doesn’t run on UTC. Having looked at my server, I’m actually running on ‘Europe/London’ time, meaning that for half the year, my signatures will be 60 minutes out, so I’l be adding this to my implementation too!

Cheers,
Alex

Hey @alexmayo,

I think that’s a great suggestion! @shrijana.g would you be able to add the following line to the Generate a Signature PHP example?

date_default_timezone_set("UTC");

This will help developers to ensure that the time they are using the correct timezone.

Thanks,
Max

2 Likes

@alexmayo Thanks for sharing this with us. @MaxM This has been added to the PHP example. :slight_smile:

Thanks,
Shrijana

2 Likes