Response to preflight request doesn’t pass access control check
-
Hi, I’m not able to get the token from the React app that I’m working on.
When I try to make a POST call with the Fetch API to the endpoint “/api-bearer-auth/v1/login” with the credentials to get the token, I get a rejected response with an 401 Unauthorized status.
Access to fetch at 'https://rest.xxxxxxx.com/wp-json/jwt-auth/v1/token' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
This doesn’t happen when I do it from Postman, apparently, as said here the way how postman and the browser send the OPTIONS request are different, and it seems that with this plugin is demanding authorization on the the pre-flight OPTIONS request, what should not be required.
I’ve tried with other plugins like “JWT Auth” and “JWT Authentication for WP REST API”, and it works perfectly but I would prefer to use this one as it offers refresh token, and protects all the endpoints, not like the others.
I hope you can give a solution for this, or something I could tweak.
Regards,
Jorge.
- The topic ‘Response to preflight request doesn’t pass access control check’ is closed to new replies.