Currently in the process of developing a program that converts addresses from a database to their corresponding lat/long coordinates using the HERE Geocoding API. In order for multiple users to utilize this program, they must manually input their app_id and app_code. However, if one of these credentials is invalid, it will return XML instead of JSON, resulting in an error message:
(SyntaxError: expected expression, got '<')
An example link to the geocoder is:
Attempts to access the error have been unsuccessful due to an existing error within the Geocoder, requiring a 30-second timeout period before the "onError" callback is triggered. Even then, no specific error code such as "invalidCredentials" is given, only an object with line and column numbers.
The geocoding service being used is quite standard.
var platform = new H.service.Platform({
app_id: 'invalidCredentialId',
app_code: 'invalidCredentialCode'
});
var geocoder = platform.getGeocodingService();
geocoder.geocode({searchText: 'Berlin'}, handleResponse, handleError);
This method does not seem to be functioning correctly. The Geocoder.geocode() function expects a JSON value to pass to the callback function, causing failure since it cannot parse XML data into a JSON object.
If this behavior is intentional, any suggestions on how to address this issue or verify the validity of provided tokens would be greatly appreciated.