Having issues with error 32?
-
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.
- The topic ‘Having issues with error 32?’ is closed to new replies.