DmitrMakeev commited on
Commit
69cdf57
·
verified ·
1 Parent(s): c1353c8

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +42 -8
index.html CHANGED
@@ -13,18 +13,52 @@
13
 
14
  </head>
15
  <body>
16
- <div class="card">
17
- <h1>Welcome to your static Space!</h1>
18
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
19
- <p>
20
- Also don't forget to check the
21
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
22
- </p>
23
- </div>
24
 
 
 
 
 
 
25
 
 
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
 
30
 
 
13
 
14
  </head>
15
  <body>
16
+ <div>
17
+ <script src="https://unpkg.com/@vkid/sdk@<3.0.0/dist-sdk/umd/index.js"></script>
18
+ <script type="text/javascript">
19
+ if ("VKIDSDK" in window) {
20
+ const VKID = window.VKIDSDK;
 
 
 
21
 
22
+ VKID.Config.init({
23
+ "app": 52295022,
24
+ "redirectUrl": "https://dmtuit-psy-vk.hf.space/pages",
25
+ "source": VKID.ConfigSource.LOWCODE,
26
+ });
27
 
28
+ const oneTap = new VKID.OneTap();
29
 
30
+ oneTap.render({
31
+ "container": document.currentScript.parentElement,
32
+ "showAlternativeLogin": true,
33
+ "styles": {
34
+ "width": 360,
35
+ "height": 56
36
+ },
37
+ "oauthList": [
38
+ "ok_ru",
39
+ "mail_ru"
40
+ ]
41
+ })
42
+ .on(VKID.WidgetEvents.ERROR, vkidOnError)
43
+ .on(VKID.OneTapInternalEvents.LOGIN_SUCCESS, function (payload) {
44
+ const code = payload.code;
45
+ const deviceId = payload.device_id;
46
 
47
+ VKID.Auth.exchangeCode(code, deviceId)
48
+ .then(vkidOnSuccess)
49
+ .catch(vkidOnError);
50
+ });
51
+ }
52
+
53
+ function vkidOnSuccess(data) {
54
+ // Обработка полученного результата
55
+ }
56
+
57
+ function vkidOnError(error) {
58
+ // Обработка ошибки
59
+ }
60
+ </script>
61
+ </div>
62
 
63
 
64