From my Angular 2 application I am trying to get data from Moqui but the request always fails with the error code 403.
Here is the REST API call implementation
getExample() { let url = 'http://localhost:8080/rest/s1/example/examples' let headers = new Headers({ 'Authorization': 'Basic am9obi5kb2U6bW9xdWk='}); headers.append('Accept', 'application/json, text/plain, */*'); headers.append('Content-Type', 'application/json; charset=UTF-8'); let options = new RequestOptions({ headers: headers }); let response = this.http.get(url, options).map(res => res.json()); return response; }
The Moqui logs :-
REST Access Forbidden (no authz): User null is not authorized for View on REST Path /example/examples
There is also a similar question Moqui Rest Nginx but from the answer I do not know that where I have to change the settings in Moqui.
On the client console the error is :-
XMLHttpRequest cannot load http://localhost:8080/rest/s1/example/examples. Response for preflight has invalid HTTP status code 403