DmitrMakeev commited on
Commit
8ec5204
·
verified ·
1 Parent(s): 117d8ce

Update user.html

Browse files
Files changed (1) hide show
  1. user.html +0 -51
user.html CHANGED
@@ -7,57 +7,6 @@
7
  </head>
8
  <body>
9
  <div id="vkid-container"></div>
10
- <script src="https://unpkg.com/@vkid/sdk@<3.0.0/dist-sdk/umd/index.js"></script>
11
- <script type="text/javascript">
12
- if ("VKIDSDK" in window) {
13
- const VKID = window.VKIDSDK;
14
- VKID.Config.init({
15
- "app": 52295022,
16
- "redirectUrl": "https://dmtuit-psy-vk.hf.space/pages",
17
- "source": VKID.ConfigSource.LOWCODE,
18
- });
19
 
20
- const oneTap = new VKID.OneTap();
21
- oneTap.render({
22
- "container": document.getElementById('vkid-container'),
23
- "showAlternativeLogin": true,
24
- "styles": {
25
- "width": 360
26
- },
27
- "oauthList": [
28
- "ok_ru",
29
- "mail_ru"
30
- ]
31
- })
32
- .on(VKID.WidgetEvents.ERROR, vkidOnError)
33
- .on(VKID.OneTapInternalEvents.LOGIN_SUCCESS, function (payload) {
34
- const code = payload.code;
35
- const deviceId = payload.device_id;
36
-
37
- // Отправляем code и deviceId на сервер для обмена на access_token
38
- fetch('/exchange_code', {
39
- method: 'POST',
40
- headers: {
41
- 'Content-Type': 'application/json'
42
- },
43
- body: JSON.stringify({ code, deviceId })
44
- })
45
- .then(response => response.json())
46
- .then(data => {
47
- if (data.error) {
48
- console.error('Error from server:', data.error);
49
- } else {
50
- console.log('User Info:', data);
51
- // Здесь можно обработать полученные данные о пользователе
52
- }
53
- })
54
- .catch(vkidOnError);
55
- });
56
- }
57
-
58
- function vkidOnError(error) {
59
- console.error('VKID Error:', error);
60
- }
61
- </script>
62
  </body>
63
  </html>
 
7
  </head>
8
  <body>
9
  <div id="vkid-container"></div>
 
 
 
 
 
 
 
 
 
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  </body>
12
  </html>