Hello, I have an application running smoothly with JSON responses, and the API key is all correct. However, when I bring this project into another browser (Sankhya OM), my key becomes invalid.
API Call:
javascriptCopy code
async function fetchData() {
const query = new URLSearchParams({
key: 'MY_KEY'
}).toString();
const resp = await fetch(
`https://graphhopper.com/api/1/vrp?${query}`,
But I receive an error:
M {message: "Request failed with status code 401", name: "AxiosError", code: "ERR_BAD_REQUEST", config: {…}, request: XMLHttpRequest, …}
code: "ERR_BAD_REQUEST"
config: {transitional: {…}, adapter: "xhr", transformRequest: Array(1), transformResponse: Array(1), timeout: 0, …}
message: "Request failed with status code 401"
name: "AxiosError"
request: XMLHttpRequest {onreadystatechange: null, readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, …}
response: {data: {…}, status: 401, statusText: "", headers: i, config: {…}, …}
stack: "AxiosError: Request failed with status code 401↵ at https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js:1:21802↵ at XMLHttpRequest.d (https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js:1:21947)"
__proto__: Error
POST https://graphhopper.com/api/1/vrp? 401
{message: "Wrong credentials. Register and get a valid API key at https: //www. graphhopper. com/developers/"}
The error is related to “HTTP request not authorized.”