Hi, I have been trying to access the REST WS from React (using Javascript fetch library) and got this error message.
Can anyone please help me solving this issue?
Code: Select all
When i don't have cross-origin resource sharing enabled, this is the error I got:Fetch API cannot load http://xxx.xxx.x.xxx:8080/OpenKM/services/rest/auth/login. Response for preflight has invalid HTTP status code 401
Code: Select all
But when i tried sending the request from Postman, it does work.Fetch API cannot load http://xxx.xxx.x.xxx:8080/OpenKM/services/rest/auth/login. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 401. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Can anyone please help me solving this issue?