• Resolved typeless

    (@jbalyo)


    I’ve created a function in my child theme’s functions.php file using the provided jwt_auth_expire hook in order to extend the life of auth tokens. However, my app developer is reporting that tokens are still expiring after 1 day even with the mod in place. Is this an outdated methodology? Is there another way to do this?

    function test_jwt_auth_expire($issuedAt) {
      return $issuedAt + (DAY_IN_SECONDS * 90);
      }
    add_filter('jwt_auth_expire', 'test_jwt_auth_expire');
    • This topic was modified 6 years, 5 months ago by typeless.
Viewing 1 replies (of 1 total)
  • @jbaylo There are a couple things wrong in your code:

    1. The docs show an example that uses time(), not the argument passed through the action (the var you’re calling $issuedAt. Change your code to return time() + (DAY_IN_SECONDS * 90);

    2. You’re also using add_filter() where you should be using add_action(). Change the code to add_action('jwt_auth_expire', 'test_jwt_auth_expire');

Viewing 1 replies (of 1 total)
  • The topic ‘jwt_auth_expire hook not working’ is closed to new replies.