I performed some more investigation around this using Postman only. It seems that when the request type is POST, the response is 200. However, when the request type is OPTIONS, the response is 405. This is why it fails in the browser when performing a CORS request to your API.
(I also updated to the latest version 2.2.2 with the same results.)
Hello,
First of all, thank you for reporting this issue.
I’m sorry about this. Some code refactor broke this feature.
I’ve fixed this issue in 2.2.3. Please update your plugin and everything should be ok.
Also, please don’t forget to rate the plugin.
Thank you.
Nicu.
Version 2.2.3 did not fix this issue for me.
Do you make the call from websiteA.com to websiteB.com and on websiteB.com you have simple-jwt-login installed with CORS enabled?
I’ve checked all the routes and it is working ok. Do you have any other API plugins installed?
I’m thinking that maybe this other plugin has a bigger “priority” for init_rest_routes, and this may cause this issue on your website.
Please fill this form:
https://eu.123formbuilder.com/form-37073/
and I will send you an email with a .zip file of the plugin, and after that, we can see if this fix will resolve your issue.
Thank you in advance.
Nicu.
PS: please make sure you have checked the checkboxes for each header from the CORS section.
After some escalation with the site hosting provider, they seem to be acknowledging the problem. They say …
We’ve confirmed that OPTIONS method is being blocked before the application/cms which is where it’s should be negotiated. We’ve escalated this issue engineering. In the meantime, and if the plugin supports, a possible workaround is to pass JWT as query string instead of sending it as Authentication header. Attaching Authentication header to a fetch request triggers CORS preflight which uses OPTIONS method.
Thank you for working with me closely earlier.