Support » Plugin: JWT Authentication for WP REST API » Extending the token life [JWT_AUTH_EXPIRE]

  • Hello,
    im having problems extending the lifetime of my token when i’m generating it with JS code.

    here is the code, commented-out lines are the ways i tried to extend the lifetime of the token..
    Any help would be appreciated.

    Thanks 🙂

    const fetchTokenOptions = {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          accept: 'application/json',
        },
        body: JSON.stringify({
          username: 'Username',
          password: 'xxxxx',
          //expire test
          // jwt_auth_expire: '157784760'
          // jwt_auth_expire: '60',
        }),
      };
    
      const getToken = async () => {
        try {
          const response = await fetch(
            // 'test.site/wp-json/jwt-auth/v1/token?filter[jwt_auth_expire]=157784760',
            'test.site/wp-json/jwt-auth/v1/token',
            fetchTokenOptions
          );
          if (response.status === 200) {
            const user = await response.json();
            return user.token;
          }
  • The topic ‘Extending the token life [JWT_AUTH_EXPIRE]’ is closed to new replies.