【发布时间】:2020-01-06 22:47:18
【问题描述】:
我已经实现了HERE tutorial 的解决方案,它在 Firefox 和 chrome 上运行良好。然而,几周前它停止了在 Firefox 上的工作并开始返回 Network Error。该请求甚至没有显示在我的网络日志中。
我已经使用我的凭据测试了API EndPoint,它确实有效。它也适用于谷歌浏览器。
我尝试通过 .env 对凭据进行硬编码,但两种方法都不适用于 firefox
我的代码:
try {
const address = await axios.get(`https://autocomplete.geocoder.api.here.com/6.2/suggest.json`,{
params: {
app_id: APP_ID_HERE,
app_code: APP_CODE_HERE,
query,
maxresults: 1,
country: 'AUS',
state: 'Western Australia'
}
});
console.log('address:',address);
} catch (error) {
console.log('address-error:',error);
}
依赖关系:
"dependencies": {
"axios": "^0.19.0",
"react": "^16.8.6",
}
HERE 是否对此 API 进行了任何更改?
我也提出了 Axios 的问题 -> https://github.com/axios/axios/issues/2388
谢谢
【问题讨论】:
-
API 没有任何变化,如果可以共享您收到的响应将会很有帮助.. 任何响应代码或错误
-
@HEREDeveloperSupport 对此有何更新?谢谢
-
这表示身份验证错误:401 - 验证 app_id/app_code 对失败。 app_code 与 app_id 不匹配,或者 app_id 无权使用 Geocoder Autocomplete API。
-
@HEREDeveloperSupport,这没有任何意义,因为它适用于 Chrome,但不适用于 Firefox!!!
-
@HEREDeveloper,我发现了问题:Firefox 阻止了一些资产,atm 一个新的 react-app 给出了这个错误:
Unhandled Rejection (SecurityError): The operation is insecure.但它在private window上正确运行,API 也适用于它。但我不确定如何解决它....
标签: reactjs axios here-api here-autocomplete