• Resolved krisosterhout

    (@krisosterhout)


    Hi Everyone,

    I was having issues with the autologin URL for this plugin. When I would attempt to use the autologin link, it would return JSON with “Wrong Request” and “ErrorCode 32”. After reviewing another thread about this issue on the forum, I found the answer (thanks to the original solver of the problem!).

    The plugin is using regex to determine if it should look at the HTTP headers, cookies, session variable, or the URL parameter. The URL parameter is the lowest on the priority when looking for the web token. The regex they’re using is always coming back as “true” for the HTTP header and, in the case of the autologin URL, this will be empty.

    The fix, while slightly technical, is to replace the regex that the plugin is using to determine if the HTTP header is empty or not. To do this, you’ll need to download the plugin and unzip it. Then, in the plugin folder, navigate to src/modules/ and then open the file “SimpleJWTLoginService”. On my editor (VSCode), on line 165, I found the regex. It looked like this:

    	preg_match(
    		'/^(?:Bearer)?[\s]*(.*)$/mi',
    		$headers[$headerKey],
    		$matches
    	);

    You’ll need to replace the string '/^(?:Bearer)?[\s]*(.*)$/mi', so that it looks like this: '/(?:Bearer ?)?(.+)/m',

    Make sure you backup your WordPress instance before altering any plugin files! If you aren’t familiar with PHP coding, I would recommend you find someone who is as this could potentially break the plugin or, worse, cause a fatal PHP error on your site that would require some advanced troubleshooting.

Viewing 1 replies (of 1 total)
  • Plugin Author nicu_m

    (@nicu_m)

    Hello @krisosterhout,

    I was unable to reproduce this issue on any of the development websites where I tested the plugin.

    This “\s” represents any whitespace character in regex, so I don’t know why you had issues with this regex, but I’m glad you found a solution.

    If you want, you can check the new plugin version, 3.0.0 from GitHub:
    https://github.com/nicumicle/simple-jwt-login

    PS: Thank you for taking your time and informing people about this possible issue, and providing a solution.

    Best regards,
    Nicu.

Viewing 1 replies (of 1 total)
  • The topic ‘Having issues with error 32?’ is closed to new replies.