plugin development - How to extend expiry time of jwt wordpress token?

admin2025-06-02  2

I am making Hybrid app with WordPress database in php, I am using JWT WordPress plugin to authenticate users. But token is expiring in almost 20 minutes, I am using following code to extend the expiry time, But it is not working. Any help is appreciate.

add_filter( 'jwt_auth_token_before_sign', 'increase_xpirty_time_token' );
function increase_xpirty_time_token( $token, $user, $aaaa, $bbbb)
{
  $issuedAt = time();
  $notBefore = apply_filters('jwt_auth_not_before', $issuedAt, $issuedAt);
  $expire = apply_filters('jwt_auth_expire', $issuedAt + (DAY_IN_SECONDS * 700), $issuedAt);


  $token = array(
    'iss' => get_bloginfo('url'),
    'iat' => $issuedAt,
    'nbf' => $notBefore,
    'exp' => $expire,
    'data' => array(
        'user' => array(
            'id' => $user->data->ID,
        )
    )
);

  return  $token;
}
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748876768a314458.html

最新回复(0)