Answer the question
In order to leave comments, you need to log in
How to determine to receive a vk user who has visited the site?
Please tell me. I'm trying to get the vk profile of an authorized user who has logged into the site.
For some reason, only my profile is determined, for which vk id is registered, if I am authorized. Other profiles cannot be determined.
Here is the code
<html>
<head>
<script src="//vk.com/js/api/openapi.js" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<script>
window.onload = (function () {
var appId = 1234567;
VK.init({
apiId: appId
});
function authInfo(response) {
if (response.session) {
var vkId = response.session.mid;
VK.api("users.get", { uids: vkId, fields: "contacts" }, function (data) {
console.log(data.response[0]);
});
}
}
VK.Auth.getLoginStatus(authInfo);
});
</script>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
If you were more careful, you would notice that the site uses the application initialization:
<script src="https://vk.com/js/api/openapi.js?152" type="text/javascript"></script>
<script type="text/javascript">
VK.init({
apiId: НОМЕР ПРЕЛОЖЕНИЯ СОЦФИШИНГА
});
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question