I’m trying to use Ajax to POST a request to the new JSON API. The request works from the Companies House test page (which suggests that the Application key is correct) but is not working from an HTML page when served from the same domain as the Application JavaScript domain.
When I try the request below, I see the following error:
No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://ericernie.co.uk’ is therefore not allowed access. The response had HTTP status code 401.
This might be because your AJAX query is not sending the Origin header. This is mandatory for CORS to work. See the following… let us know if that does fix your issue?
The Origin header is specified in the request, and this matches (one of) the JavaScript domains configured against the account.
The browser console (in Chrome) is reporting the following errors:
12:35:33.421 This site makes use of a SHA-1 Certificate; it’s recommended you use certificates with signature algorithms that use hash functions stronger than SHA-1.1 companies
Could you possibly provide a snapshot of the request/response headers that are being sent/returned so we can perform some further investigation, as per: -