home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.13k stars 29.8k forks source link

HERE Routing API no access #99437

Closed DarthSonic closed 4 months ago

DarthSonic commented 1 year ago

The problem

I cannot access HERE Routing API. I generated several API keys and OAuth credentials but none work: 'These credentials do not authorize access'.

What version of Home Assistant Core has the issue?

core-2023.8.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

HERE Travel Time

Link to integration documentation on our website

https://www.home-assistant.io/integrations/here_travel_time/

Diagnostics information

home-assistant_here_travel_time_2023-09-01T07-49-23.141Z.log

Example YAML snippet

service: homeassistant.update_entity
data: {}
target:
  entity_id:
    - sensor.sven_opnv_nach_hause_dauer
    - sensor.yvonne_opnv_nach_hause_dauer

Anything in the logs that might be useful for us?

Logger: homeassistant.components.here_travel_time.coordinator
Source: components/here_travel_time/coordinator.py:203
Integration: HERE Travel Time (documentation, issues)
First occurred: 28. August 2023 um 22:55:42 (5 occurrences)
Last logged: 31. August 2023 um 19:23:55

Unexpected error fetching here_travel_time data: (403, {'error': 'Forbidden', 'error_description': 'These credentials do not authorize access'})
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/here_travel_time/coordinator.py", line 203, in _async_update_data
    response = await self._api.route(
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/here_transit/here_transit.py", line 202, in route
    response = await self.request(uri=ROUTES_PATH, params=params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/here_transit/here_transit.py", line 133, in request
    raise HERETransitError(response.status, json.loads(decoded_contents))
here_transit.exceptions.HERETransitError: (403, {'error': 'Forbidden', 'error_description': 'These credentials do not authorize access'})

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @eifinger, mind taking a look at this issue as it has been labeled with an integration (here_travel_time) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `here_travel_time` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign here_travel_time` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


here_travel_time documentation here_travel_time source (message by IssueLinks)

eifinger commented 1 year ago

Hi. So this means you could add an integration entry without errors and as soon as you update the entity on demand it shows the error.

Has an update ever succeeded? As is in have you ever seen a travel time in your UI or only "unavailable"?

DarthSonic commented 1 year ago

exactly. it worked a few times than stopped without any action by me.

eifinger commented 1 year ago

Could you please share the debug logs by following these instructions? https://www.home-assistant.io/docs/configuration/troubleshooting/#debug-logs-and-diagnostics

DarthSonic commented 12 months ago

I cannot see "Download Diagnostics" link for Here integation. I allready attached debug log on issue creation but attached a second one now. home-assistant_here_travel_time_2023-09-15T18-21-19.416Z.log

eifinger commented 12 months ago

I cannot see "Download Diagnostics" link for Here integation. I allready attached debug log on issue creation but attached a second one now. home-assistant_here_travel_time_2023-09-15T18-21-19.416Z.log

Thank you. I didn't see the log file before.

eifinger commented 11 months ago

I cannot reproduce the issue on my end and don't understand what the problem is. Can you execute the following curl statement with your api key taken from the official docs?

curl -X GET \
  'https://router.hereapi.com/v8/routes?transportMode=car&origin=52.5308,13.3847&destination=52.5323,13.3789&return=summary&apikey={YOUR_API_KEY}'

If this also returns a 403 then I suggest to contact HERE support.

DarthSonic commented 11 months ago

Windows Client: image

HA Server: image

Both work, but integration not.

eifinger commented 11 months ago

Thank you. Will try to get to the bottom of this.

eifinger commented 11 months ago

I cannot reproduce the error on my instance. I used your api key from the last screenshot and the coordinates from the log file you provided (Gude und Grüße aus Mainz in die "Nachbarschaft") but got no error.

You have tried to setup several entries with different generated credentials and always got the same error, correct?

Can you remove all HERE Travel Time entries and try again? I currently can't think of a reason why this works for me, your cli, your container but not for your HA instance.

DarthSonic commented 11 months ago

Gude!

I have tried at least two keys with the same experience: First few calls worked, after that no more access.

I will try generating new keys and entities in the next few days.

DarthSonic commented 8 months ago

Gude!

I configured all my entities new with newly created API key but still the same:

Logger: homeassistant.components.here_travel_time.coordinator
Source: helpers/update_coordinator.py:300
Integration: HERE Travel Time (documentation, issues)
First occurred: 7. Januar 2024 um 15:13:49 (25 occurrences)
Last logged: 18:06:45

Unexpected error fetching here_travel_time data: (403, {'error': 'Forbidden', 'error_description': 'These credentials do not authorize access'})
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/here_travel_time/coordinator.py", line 203, in _async_update_data
    response = await self._api.route(
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/here_transit/here_transit.py", line 202, in route
    response = await self.request(uri=ROUTES_PATH, params=params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/here_transit/here_transit.py", line 133, in request
    raise HERETransitError(response.status, json.loads(decoded_contents))
here_transit.exceptions.HERETransitError: (403, {'error': 'Forbidden', 'error_description': 'These credentials do not authorize access'})
DarthSonic commented 8 months ago

P.S.: I have two users configured in HERE app. Only one API key, and disabled trusted domain.

I think "publicTransport" is not available for API.

When using this with my API Key I will get response:

https://router.hereapi.com/v8/routes?apiKey=xyz&routingMode=fast&transportMode=bus&origin=50.1812,8.746&destination=50.20382,8.73724

eifinger commented 8 months ago

Can you please contact me on discord under eifinger#0669?

issue-triage-workflows[bot] commented 5 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.