Update user.html
Browse files
user.html
CHANGED
@@ -4,24 +4,30 @@
|
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>VK Authorization</title>
|
7 |
-
|
8 |
-
<
|
9 |
-
<div id="vk_api_transport"></div>
|
10 |
-
<script type="text/javascript">
|
11 |
-
window.vkAsyncInit = function() {
|
12 |
VK.init({
|
13 |
apiId: 52295022
|
14 |
});
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
el.async = true;
|
22 |
-
document.getElementById("vk_api_transport").appendChild(el);
|
23 |
-
}, 0);
|
24 |
-
</script>
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
</body>
|
27 |
</html>
|
|
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>VK Authorization</title>
|
7 |
+
<script src="https://vk.com/js/api/openapi.js?169"></script>
|
8 |
+
<script>
|
|
|
|
|
|
|
9 |
VK.init({
|
10 |
apiId: 52295022
|
11 |
});
|
12 |
+
</script>
|
13 |
+
</head>
|
14 |
+
<body>
|
15 |
+
<div id="vk_auth_button"></div>
|
16 |
+
<script>
|
17 |
+
VK.UI.button("vk_auth_button");
|
|
|
|
|
|
|
|
|
18 |
|
19 |
+
document.getElementById("vk_auth_button").addEventListener("click", function() {
|
20 |
+
VK.Auth.login(function(response) {
|
21 |
+
if (response.session) {
|
22 |
+
/* Пользователь успешно авторизовался */
|
23 |
+
console.log("User ID:", response.session.user.id);
|
24 |
+
console.log("User Info:", response.session.user);
|
25 |
+
} else {
|
26 |
+
/* Пользователь нажал кнопку Отмена в окне авторизации */
|
27 |
+
console.log("Authorization canceled");
|
28 |
+
}
|
29 |
+
}, 4); // Запрос прав на доступ к фотографиям (пример)
|
30 |
+
});
|
31 |
+
</script>
|
32 |
</body>
|
33 |
</html>
|