Hello, I have problem can't request endpoint: deletefaceid with error message console.log as below:
Access to XMLHttpRequest at 'https://api.faceio.net/deletefacialid?key=de45caf9868055f88e2015c601c9d29b&fid=b52421cea2f141009242d1c77082bfcafioab145' from origin 'https://sys.larrytabus.com' 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.
Please help check how to fix this problem.
Thanks
XMLHttpRequest fail when deleting a Facial ID
✓ Accepted Solution
Hello,
Thanks for reaching out, and welcome to the FACEIO support center. To answer your inquiry:
The error you're seeing is related to Cross-Origin Resource Sharing (CORS). CORS is a security feature implemented by web browsers to prevent unauthorized domains from making requests to another domain, which can be potentially harmful. Here's a breakdown of the error message:
- XMLHttpRequest at 'api.faceio.net/deletefacialid' documented here. This indicates that there was an attempt to make an XMLHttpRequest (often used for AJAX requests) to the specified URL from your Vue or React web app.
-
has been blocked by CORS policy: This indicates that the browser blocked the request because it violates the CORS policy.
-
Response to preflight request doesn't pass access control check: Before making the actual request, browsers send a "preflight" request (using the HTTP OPTIONS method) to check if the actual request is allowed. This error suggests that this preflight request failed its check.
Solution:
- Simply clear your old browser (development) cache, reload your application, and initiate the API call again.
- If the issue persists, you may refer to this StackOverflow thread at: https://stackoverflow.com/questions/54212220/how-to-fix-access-to-xmlhttprequest-has-been-blocked-by-cors-policy-redirect-i on how to deal with the issue on your frontend..
Feel free to reply to this thread if you need further assistance.