跨域错误工作灯适配器请求



我正在尝试从iPhone应用程序(基于Worklight构建(向远程服务器上的远程worklight适配器发出GET请求。我使用以下方法生成了授权请求标头

http://remote-url:port/project/authorization/v1/testtoken

但是,我不断收到以下跨域错误:

XMLHttpRequest cannot load https://remote-url/project/adapters/call/mq/getAccounts/22. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://myapp-url:port' is therefore not allowed access.

但是,当我尝试使用像 Postman 这样的 API 工具执行相同的GET请求时,我的浏览器上收到的结果没有问题。

首先 - testtoken 只能在 MobileFirst Studio 开发环境中使用...您需要考虑到这一点。

其次,您可能正在使用Chrome,而Crome默认不允许CORS。更改浏览器设置和/或尝试使用其他浏览器。

最新更新