Update user.html
Browse files
user.html
CHANGED
@@ -5,11 +5,6 @@
|
|
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 |
<style>
|
14 |
/* Стили для контейнера кнопки */
|
15 |
.button-con2 {
|
@@ -45,17 +40,23 @@
|
|
45 |
</div>
|
46 |
|
47 |
<script>
|
48 |
-
document.
|
49 |
-
VK.
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
});
|
60 |
</script>
|
61 |
</body>
|
|
|
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 |
<style>
|
9 |
/* Стили для контейнера кнопки */
|
10 |
.button-con2 {
|
|
|
40 |
</div>
|
41 |
|
42 |
<script>
|
43 |
+
document.addEventListener('DOMContentLoaded', function() {
|
44 |
+
VK.init({
|
45 |
+
apiId: 52295022
|
46 |
+
});
|
47 |
+
|
48 |
+
document.getElementById("vk_auth_button").addEventListener("click", function() {
|
49 |
+
VK.Auth.login(function(response) {
|
50 |
+
if (response.session) {
|
51 |
+
/* Пользователь успешно авторизовался */
|
52 |
+
console.log("User ID:", response.session.user.id);
|
53 |
+
console.log("User Info:", response.session.user);
|
54 |
+
} else {
|
55 |
+
/* Пользователь нажал кнопку Отмена в окне авторизации */
|
56 |
+
console.log("Authorization canceled");
|
57 |
+
}
|
58 |
+
}, 4); // Запрос прав на доступ к фотографиям (пример)
|
59 |
+
});
|
60 |
});
|
61 |
</script>
|
62 |
</body>
|