Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with laravel timezone #95

Closed
alitnk opened this issue Apr 27, 2021 · 3 comments · Fixed by #98
Closed

Problem with laravel timezone #95

alitnk opened this issue Apr 27, 2021 · 3 comments · Fixed by #98

Comments

@alitnk
Copy link

alitnk commented Apr 27, 2021

First of all, thanks for the amazing package.

When I set app.php's zime zone to my local time zone, the eventsub webhook URL keeps throwing SignatureVerificationException with the message Timestamp outside the tolerance zone, it works when I set it back to Laravel's default though.

Is this perhaps a problem on my side?

@romanzipp
Copy link
Owner

romanzipp commented Apr 28, 2021

That's strange. PHP should always use the UTC timestamps in both time and strototime functions when comparing the header and current timestamps.

Could you try out #98 ? This PR introduces time comparisons via Carbon

"romanzipp/laravel-twitch": "dev-fix-event-sub-verification-tolerance",

@romanzipp romanzipp mentioned this issue Apr 28, 2021
@alitnk
Copy link
Author

alitnk commented Apr 28, 2021

Thanks for the response,

I tried the PR, I confirm it works with my time zone.

@ghostzero
Copy link
Contributor

ghostzero commented Apr 29, 2021

That's strange. PHP should always use the UTC timestamps in both time and strototime functions when comparing the header and current timestamps.

strototime and time takes the time set in PHP. This can actually cause problems if you have not set your system time to UTC. I can reproduce it by the following example:

<?php

// Europe/Berlin
echo date_default_timezone_get() . PHP_EOL;

// 1619729603
echo strtotime('2021-04-29 22:53:23') . PHP_EOL;

date_default_timezone_set('America/New_York');

// 1619751203
echo strtotime('2021-04-29 22:53:23') . PHP_EOL;

// 1619729603 !== 1619751203

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants