A
A
and7ey2015-01-19 19:55:46
JavaScript
and7ey, 2015-01-19 19:55:46

How to get a list of audio recordings from a VKontakte group using Open API?

How to get a list of audio recordings from a given open VKontakte group using the Open API ?
From incomprehensible moments, in particular, - VK.Auth.getLoginStatus returns status = 'connected' only if the user is authorized and granted rights to the application? Or if authorized, but did not give the right, then too? If so, how to check the rights and request them?
Tried using the following code -

<button type="button" onclick="VK.Auth.login(vk_auth, 8);">

<script src="http://vk.com/js/api/openapi.js" type="text/javascript"></script>
<script type="text/javascript">
  function vk_auth(response) {
    console.log('response: '+response);
    if (response.session) {
      console.log('VK user authenticated');
      console.log(response);
      if (response.status === 'connected') {
        var uid = response.session.mid;
        var sid = response.session.sid;
        console.log('uid: '+uid+', sid: '+sid);
        VK.Api.call('audio.get', {owner_id: '-8398xxxx', need_user: '0', count: '6000'}, function(r) {
          console.log(r);
          if (r.response) {
            // 
          }
        });

      }
    } else {
      console.log('VK user failed to authenticate');
    }
  }

  VK.init({
    apiId: 1234567
  });

  VK.Auth.getLoginStatus(vk_auth);
</script>

But judging by the log, the audio.get request returns a 500 error.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2015-01-19
@Sanasol

https://vk.com/dev/account.getAppPermissions

if(response & 8) { 
  alert('нужен доступ к аудио'); 
}

If the answer does not contain what you need (access to audio, for example, above), you need to ask for permission again, or not give access to the function.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question