V
V
violentp2019-07-19 22:49:27
JavaScript
violentp, 2019-07-19 22:49:27

How to get data from dynamic widget OnAuth VKontakte?

<script type="text/javascript" src="https://vk.com/js/api/openapi.js?161"></script>
<script type="text/javascript">
  VK.init({apiId: #####});
</script>

<!-- VK Widget -->
<div id="vk_auth"></div>
<script type="text/javascript">
  VK.Widgets.Auth("vk_auth", {"onAuth":"function(data) {alert(\'user \'+data[\'uid\']+\' authorized\');}"});
</script>

After authorization, you need to display the user ID on the screen.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stockholm Syndrome, 2019-07-20
@StockholmSyndrome

try without quotes

VK.Widgets.Auth("vk_auth", {"onAuth":function(data) {alert('user '+data['uid']+' authorized')}});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question