Coder Social home page Coder Social logo

Comments (16)

glena avatar glena commented on July 20, 2024 51

Try setting the leeway in the php-jwt.

Somewhere in your project before the auth0 sdk is initialized add this line:

\Firebase\JWT\JWT::$leeway = X;

this will let you move the time window X seconds, ceck if you are ahead or behind and play with it until you find a confortable value.

from auth0-php.

fsiatama avatar fsiatama commented on July 20, 2024 4

ntpdate -q 0.rhel.pool.ntp.org
chkconfig ntpdate on
service ntpdate start

from auth0-php.

SimonEast avatar SimonEast commented on July 20, 2024 1

My ugly hack/workaround for now was to comment out the exception in 2 places in /vendor/firebase/php-jwt/Authentication/JWT.php:

//---------------------------------------
// Temporarily commenting out to fix bug
//---------------------------------------
// throw new BeforeValidException(
//     'Cannot handle token prior to ' . date(DateTime::ISO8601, $payload->nbf)
// );
//---------------------------------------   

I'm not sure if that reduces the security significantly or anything? I suspect not by much.

from auth0-php.

glena avatar glena commented on July 20, 2024

@SimonEast did it work?

from auth0-php.

SimonEast avatar SimonEast commented on July 20, 2024

OK, awesome. That's the kinda thing I was looking for. Haven't tried it yet but hope to do so in the next 1-2 weeks and will try post back how it goes.

from auth0-php.

glena avatar glena commented on July 20, 2024

sure, I will close the issue for now but feel free to open a new one (or just ping me here)

from auth0-php.

SeanZicari avatar SeanZicari commented on July 20, 2024

@SimonEast Did the leeway setting work for you? What setting did you settle on?

from auth0-php.

SimonEast avatar SimonEast commented on July 20, 2024

@SeanZicari I actually can't remember what I did with it 12 months ago, I'm sorry. I'd have to dig through my source code, which I may not get time to do very soon due to life circumstances. I apologize.

from auth0-php.

glena avatar glena commented on July 20, 2024

@SeanZicari the leeway should do the trick, anyway if it is posible check that your server's timezone is well configured and that it is sincronized with an NTP server so it keeps up to date.

Also, can you check what is the difference between the server time and the current time?

from auth0-php.

SeanZicari avatar SeanZicari commented on July 20, 2024

@glena Thanks! I increased the leeway to 120 seconds. Is that excessive? It did seem to resolve the issue.

from auth0-php.

glena avatar glena commented on July 20, 2024

@SeanZicari it is not a good idea because you are opening the expiration window. It is always better to try to keep the server time in sync to avoid future issues.

from auth0-php.

SeanZicari avatar SeanZicari commented on July 20, 2024

@glena That makes sense. The issue I was having seemed to be related to one individual auth0 account that was causing that error to be thrown when trying to log in as them. I don't know enough about what's going on behind the scenes to know how else to fix it.

from auth0-php.

glena avatar glena commented on July 20, 2024

if you have ssh access to the server, you can check the time of it (if it is linux by running date) and check if it is correct (time and timezone). Probably it is some minutes off.

If that is the case, I would recommend to configure it to be in sync with an NTP service or if it is already configured you will need to troubleshoot why it is not working.

from auth0-php.

SeanZicari avatar SeanZicari commented on July 20, 2024

from auth0-php.

sohailrajdev97 avatar sohailrajdev97 commented on July 20, 2024

@glena Thanks. This solved the problem.

from auth0-php.

github-actions avatar github-actions commented on July 20, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from auth0-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.