Blocked by CORS Policy
-
Hi,
I’m testing an Angular Application on localhost:4200 to use my WordPress Woocommerce Site’s user credentials using this OAuth Server plugin. I’m able to redirect the users to the /wp-content/plugins/miniorange-oauth-20-server/web/moserver/authorize endpoint, get the user consent and then get the authorization code.
However, when I do a post request to the /wp-content/plugins/miniorange-oauth-20-server/web/moserver/token endpoint with all the correct details, I keep getting the following error :
Access to XMLHttpRequest at 'https://mydomain.com/wp-content/plugins/miniorange-oauth-20-server/web/moserver/token' from origin 'https://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I don’t want to completely enable CORS and create security issues, since the Woocommerce store is a live one. Is there any way by which I can allow post requests from localhost for now during testing and then once deployed, allow requests from the application’s URL?
Can you please help me out?
Regards,
Arjun
- The topic ‘Blocked by CORS Policy’ is closed to new replies.