Neither can I deal with CORS.
There is such a simple code:
function loadUserInfo(userId) { var xhr = new XMLHttpRequest(); xhr.open('GET', 'https://api.vkontakte.ru/method/users.get?version=5.57&user_ids=' + userId, false); xhr.withCredentials = true; xhr.send(); if (xhr.status != 200) { return false; } else { return JSON.parse(xhr.responseText).response.shift(); } } With it, I want to get information about the newly logged in user. Constantly crashes:
vk.html: 37 XMLHttpRequest cannot load https://api.vkontakte.ru/method/users.get?version=5.57&user_ids=209295007 . No 'Access-Control-Allow-Origin' header is present. Origin ' http://mysite.ru ' is not allowed access.
I checked the base domains in the VC application, added withCredentials = true , but all this does not solve the problem.
withCredentials = truewill not help ...... Either use openAPI - Alexey Shimansky