Page 1 of 1

Accessing REST WS Issue

PostPosted:Fri Sep 01, 2017 10:02 am
by olw
Hi, I have been trying to access the REST WS from React (using Javascript fetch library) and got this error message.
Code: Select all
Fetch API cannot load http://xxx.xxx.x.xxx:8080/OpenKM/services/rest/auth/login. Response for preflight has invalid HTTP status code 401
When i don't have cross-origin resource sharing enabled, this is the error I got:
Code: Select all
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.
But when i tried sending the request from Postman, it does work.
Can anyone please help me solving this issue?

Re: Accessing REST WS Issue

PostPosted:Fri Sep 01, 2017 10:09 am
by olw
I have solved this issue by doing this:

viewtopic.php?f=6&t=20618