Answer the question
In order to leave comments, you need to log in
Why can't I connect to YandexWebmaster API?
Hello. This is the first time I've come across public APIs and I would like to understand what my mistake is.
I received the debug token, after which I accessed the following URL: https://api.webmaster.yandex.net/v4/user/
Now my request for getting the user ID looks like this.
fetch('https://api.webmaster.yandex.net/v4/user/', {
method: 'GET',
headers: {
"Authorization": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
})
.then(response => {
alert('test');
});
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.webmaster.yandex.net/v4/user/. (Reason: CORS header 'Access-Control-Allow-Origin' missing).
TypeError: NetworkError when attempting to fetch resource.
fetch('https://api.webmaster.yandex.net/v4/user/', {
method: 'GET',
headers: {
"Access-Control-Allow-Origin": "*",
"Authorization": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
})
.then(response => {
alert('test');
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question