Update pages.html
Browse files- pages.html +0 -52
pages.html
CHANGED
@@ -1158,58 +1158,6 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
|
|
1158 |
|
1159 |
|
1160 |
|
1161 |
-
<script src="https://unpkg.com/@vkid/sdk@<3.0.0/dist-sdk/umd/index.js"></script>
|
1162 |
-
<script type="text/javascript">
|
1163 |
-
if ("VKIDSDK" in window) {
|
1164 |
-
const VKID = window.VKIDSDK;
|
1165 |
-
VKID.Config.init({
|
1166 |
-
"app": 52295022,
|
1167 |
-
"redirectUrl": "https://dmtuit-psy-vk.hf.space/pages",
|
1168 |
-
"source": VKID.ConfigSource.LOWCODE,
|
1169 |
-
});
|
1170 |
-
|
1171 |
-
const oneTap = new VKID.OneTap();
|
1172 |
-
oneTap.render({
|
1173 |
-
"container": document.getElementById('vkid-container'),
|
1174 |
-
"showAlternativeLogin": true,
|
1175 |
-
"styles": {
|
1176 |
-
"width": 360
|
1177 |
-
},
|
1178 |
-
"oauthList": [
|
1179 |
-
"ok_ru",
|
1180 |
-
"mail_ru"
|
1181 |
-
]
|
1182 |
-
})
|
1183 |
-
.on(VKID.WidgetEvents.ERROR, vkidOnError)
|
1184 |
-
.on(VKID.OneTapInternalEvents.LOGIN_SUCCESS, function (payload) {
|
1185 |
-
const code = payload.code;
|
1186 |
-
const deviceId = payload.device_id;
|
1187 |
-
|
1188 |
-
// Отправляем code и deviceId на сервер для обмена на access_token
|
1189 |
-
fetch('/exchange_code', {
|
1190 |
-
method: 'POST',
|
1191 |
-
headers: {
|
1192 |
-
'Content-Type': 'application/json'
|
1193 |
-
},
|
1194 |
-
body: JSON.stringify({ code, deviceId })
|
1195 |
-
})
|
1196 |
-
.then(response => response.json())
|
1197 |
-
.then(data => {
|
1198 |
-
if (data.error) {
|
1199 |
-
console.error('Error from server:', data.error);
|
1200 |
-
} else {
|
1201 |
-
console.log('User Info:', data);
|
1202 |
-
// Здесь можно обработать полученные данные о пользователе
|
1203 |
-
}
|
1204 |
-
})
|
1205 |
-
.catch(vkidOnError);
|
1206 |
-
});
|
1207 |
-
}
|
1208 |
-
|
1209 |
-
function vkidOnError(error) {
|
1210 |
-
console.error('VKID Error:', error);
|
1211 |
-
}
|
1212 |
-
</script>
|
1213 |
|
1214 |
|
1215 |
|
|
|
1158 |
|
1159 |
|
1160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1161 |
|
1162 |
|
1163 |
|