SocialiteProviders / Providers

A Collection of Providers for Laravel Socialite
https://socialiteproviders.com
MIT License
506 stars 445 forks source link

Cannot set JWT leeway #1260

Open thomasfw opened 2 months ago

thomasfw commented 2 months ago

I'm getting a Firebase\JWT\BeforeValidException exception so I've resorted to setting JWT leeway as below, which fixes the issue:

Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
    \Firebase\JWT\JWT::$leeway = 60; // <----- Fix
    $event->extendSocialite('azureadb2c', \SocialiteProviders\AzureADB2C\Provider::class);
});

I've rather not use \Firebase\JWT\JWT directly as it might change depending on your implementation.

I do see some related issues (https://github.com/SocialiteProviders/Providers/issues?q=leeway) and a comment mentioning that it was fixed in #811, but I can't find the solution documented anywhere or from scanning the source code.

atymic commented 2 months ago

Feel free to PR a fix :)