Getting ERR_ABORTED 401
I am calling RestCore API - ‘GET/communities’ from my JavaScript code (generated automatically using Postman). Postman call is working fine. I have provided the correct authentication. However, I am getting 401 (UNAUTHORIZED) error when I call through Javascript code. Interestingly, it is not encountered from Python(means, I can retrieve a successful response from Python code).
My code is working if we fetch a response from the public API call.
Can you suggest, how can I resolve this error
I have attached a snippet of code below
var requestOptions = {
method: 'GET',
headers: {"Authorization": "Basic #value"},
redirect: 'follow',
mode:'no-cors'
};
console.log(requestOptions);
fetch("#URL", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));Former User
Posted 5 years ago · Edited 1 year ago·Last reply 5 years ago
1 comment
arthurburkhardt
·5 years ago · EditedWell… the error message says you are not authorized, so probably you are not logged in correctly when making the API call…
Check the logs and see what it says. My guess is that either you are not managing authentication at all, or with an incorrect configuration.
If you’re reusing your cookie from the platform, maybe your personal account is not allowed to make API calls, while you’re using a technical account for the python calls.