blint
blint

Reputation: 53

Here maps reverse geocode API

I want to implement some new features in my project, where it is needed to use features from geocode API. My problem is... 401 Unauthorized error, which returns from API.

By the way, basic maps with routes and markers works like a harm without any errors.

When I requesting: https://reverse.geocoder.api.here.com/6.2/reversegeocode.json with proper parameters like app_id, app_code and prox I got message:

enter image description here

What goes wrong? Thanks in advance for any tips.

Upvotes: 0

Views: 1383

Answers (1)

j12y
j12y

Reputation: 2432

From the FAQ:

HERE APIs use two random strings, app_id and app_code, to provide secure access to services.

HERE APIs use a combination of these 2 random strings to identify users and applications and to track usage for an application.

For greater protection, you can associate specific domains, referrers or hostnames to an app_id on the Project Details page.

If you are getting an unauthorized 401 Unauthorized error that suggests your app_id and app_code are not configured properly. A few steps you could take to get to the bottom of this:

  1. Go to your Projects page to create a new project and generate a new app_id and app_code.

  2. Go to the Reverse Geocode Example page and paste your app_id and app_code into the form to make sure you can get back a response.

  3. With a successful result of those first two steps, you can begin investigating your original use case to find where the issue might be. Some suggestions:

    • Are you sure you copied the app_id and app_code properly into your application?

    • Are you sure you are passing both the app_id and app_code as parameters in your request?

    • Have you enabled domain restrictions for this new project that all requests must originate from the same domain?

    • Shouldn't be an issue with your case with the reverse geocoder, but if you are using other pro services there may be a licensing restriction on how to use certain APIs. That is not the case with reverse geocoder though.

Anytime I've experienced an Unauthorized like the one your observed, I was accidentally not passing the app_code correctly in my request.

Upvotes: 1

Related Questions