• Resolved pdxmusic

    (@pdxmusic)


    Hello Nicu,
    first i have to thank you for your awesome plugin and for your effort on the support.

    I’m having a small issue after i upgraded the plugin to the latest version on my production server.
    I have to upgrade it because i need your awesome new function to hook the redirect and in my staging website the login works great.

    As shown in the url i got the error “{“success”:false,”data”:{“message”:”Wrong Request.”,”errorCode”:23}}”, i tried to take a look on your earlier answers and i saw that this error occurs because a wrong JWT.

    The fun fact is that the JWT is correct, in the older version (1.2.1) it’s working well and also in another staging server with the same php version and with the plugin updated to the latest (2.2.6).

    Do you have any idea about what’s wrong?

    Thanks in advance

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Nicu Micle

    (@nicu_m)

    Hello @pdxmusic,

    I’ve investigated this issue, and, this error code comes only when there is no JWT in request,cookie,session or header.

    Please go to plugin settings -> General, and make sure that URL is set to “on” for “Get JWT token from”.

    Also, you mentioned that on 1.2.1 woked ok. do you mean 2.2.1?

    Please let me know if this fixes your issue.

    Best regards,
    Nicu.

    Thread Starter pdxmusic

    (@pdxmusic)

    Thanks for you quick answer,

    I already checked in plugin settings -> General, and URL is set to “on” for “Get JWT token from” (tried also the beta feature)

    And no, i meant 1.2.1, i used a super old version but since it was working great i never had to update it.

    If i switch plugins folder from 1.2.1 to 2.2.6 it works again.
    The strange fact it that i’m using the same plugin with same configuration on another clone website and it works.

    I tried also to reinstall the plugin but the problem remain.
    I have no clues

    • This reply was modified 5 years, 10 months ago by pdxmusic.
    Thread Starter pdxmusic

    (@pdxmusic)

    UPDATE

    After many tests i tried to edit SimpleJWTLoginService.php at line 195 to force the get of jwt, now the login works but i’m not able to use the redirect hook.

    $this->jwt = $_GET[‘jwt’];
    if ( empty( $this->jwt ) ) {
    throw new Exception( __( ‘Wrong Request.’, ‘simple-jwt-login’ ),
    ErrorCodes::ERR_VALIDATE_LOGIN_WRONG_REQUEST );
    }

    Plugin Author Nicu Micle

    (@nicu_m)

    Hello,

    My first guess, is that you have to uninstall the old plugin and install the new version. After that, you could make the setup.

    Also, I think, you have to delete the option name simple-jwt-login-settings from the wp-options table manually. In 1.2.1, on uninstall, there is no hook that removes the old settings from DB on plugin uninstall.

    I can help you setting up the plugin. In case you need help, please fill this form: https://eu.123formbuilder.com/form-37073/

    Best regards,
    Nicu.

    Thread Starter pdxmusic

    (@pdxmusic)

    Hello Nicu,
    i tried to remove the option from the database and after reconfiguring the plugin i still have the same issue, i have to keep the mod $this->jwt = $_GET[‘jwt’]; or i still get the error 23.

    The redirect hook still doesn’t work but i now get redirected correctly because i pass the variable redirect to the authentication url.

    This is how i’m now forcing redirect

    //GET THE URL
    $redirect=$decoded_array['redirect'];
    //I EXTRACT WHAT I NEED
    $search = 'https://MYWEBSITE.com/?post_type=' ;
    $newredirect = str_replace($search, '', $redirect) ;
    
    //THIS IS THE RESULT $newredirect = video&p=5060
    
    header("location: https://MYWEBSITE.COM/?rest_route=/simple-jwt-login/v1/autologin&jwt=$tokenlogin&redirect=$newredirect");

    It’s tricky but it works.

    • This reply was modified 5 years, 10 months ago by pdxmusic.
    • This reply was modified 5 years, 10 months ago by pdxmusic.

    Apologies to piggy back on your issue but I’m also noticing a Wrong Request error when sending the jwt in url query param. I believe the issue is related to me having both the Header and URL options selected in the general settings. If I turn off the Header option, leaving url as the only authentication option, the jwt query param is detected fine and the redirect occurs.

    A friend helped me solve the issue. It appears as though the conditional for grabbing the header jwt was matching no matter what on our site. The fix was to change the regular expression so it requires jwt to not be empty… '/(?:Bearer ?)?(.+)/m'

    Plugin Author Nicu Micle

    (@nicu_m)

    Hello @jachenry,

    Thank you for the info. I will make a new release in 1-2 days, and I will also include this.

    I will come back with updates.

    Best regards,
    Nicu.

    Plugin Author Nicu Micle

    (@nicu_m)

    Hello,
    I’ve just released version 2.2.7. This version fixes the issue by getting the JWT from the header.

    Please let me know if everything is working as expected.

    Best regards,
    Nicu.

    Thread Starter pdxmusic

    (@pdxmusic)

    Sorry for the late answer,
    i finally had some time to test the new version and now everything work as it should.
    Big thanks to you guys @jachenry and @nicu_m, you are awesome!

    Best regards

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘{“success”:false,”data”:{“message”:”Wrong Request.”,”errorCode”:23}}’ is closed to new replies.