0

调用here api后出现权限错误。 https://route.cit.api.here.com/routing/7.2/calculateroute.json?jsonAttributes=1&waypoint0=51.31854,9.51183&waypoint1=50.11208,8.68342&departure=2019-01-18T10:33:00&routeattributes=sh,lg&legattributes=li&linkattributes=nl,fc&mode=fastest;car;traffic:enabled&app_code=xx&app_id=xx

我将它用于app_code 的APP Id 和API Key 但不起作用。如何解决这个问题?

在此处输入图像描述

{
    "_type": "ns2:RoutingServiceErrorType",
    "type": "PermissionError",
    "subtype": "InvalidCredentials",
    "details": "This is not a valid app_id and app_code pair. Please verify that the values are not swapped between the app_id and app_code and the values provisioned by HERE (either by your customer representative or via http://developer.here.com/myapps) were copied correctly into the request.",
    "metaInfo": {
        "timestamp": "2021-12-14T14:26:21Z",
        "mapVersion": "8.30.127.153",
        "moduleVersion": "7.2.202150-9770",
        "interfaceVersion": "2.6.77",
        "availableMapVersion": [
            "8.30.127.153"
        ]
    }
}
4

1 回答 1

2

app_code 与 apiKey 不同。

app_id/app_code 组合是 HERE 位置服务的一种已弃用的身份验证方法,这就是为什么您不会再在开发人员门户中找到与您的 app_id 匹配的 app_code 的原因。

相反,请尝试仅使用 apiKey:

https://route.ls.hereapi.com/routing/7.2/calculateroute.json?jsonAttributes=1&waypoint0=51.31854,9.51183&waypoint1=50.11208,8.68342&departure=2019-01-18T10:33:00&routeattributes=sh,lg&legattributes=li&linkattributes=nl,fc&mode=fastest;car;traffic:enabled&apiKey=[YOUR_API_KEY]

请注意,使用 apiKey 时,基本 URL 略有不同。

于 2021-12-14T17:53:54.590 回答