Answer the question
In order to leave comments, you need to log in
XMLHttpRequest and VK openapi?
Hello.
Please tell me how to overcome the error when trying to use openapi VKontakte.
Access to XMLHttpRequest at ' https://login.vk.com/?act=openapi&oauth=1&aid=6995... ' from origin 'null' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values ' http://localhost, *', but only one is allowed.
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="https://vk.com/js/api/openapi.js?160" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
window.onload = (function() {
VK.init({
apiId: 6995083
});
function authInfo(response) {
console.log(response);
}
VK.Auth.getLoginStatus(authInfo);
})
</script>
</body>
</html>
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