A
A
artjerom2016-06-07 19:32:09
JavaScript
artjerom, 2016-06-07 19:32:09

How to get a list of audio recordings through api vk?

You need to get a list of user's audio recordings through api vk on node js .

var VK = require('vksdk');
var vk = new VK({
   'appId'     : [id приложение],
   'appSecret' : '[секретный ключ]'
});


vk.setSecureRequests(false);
vk.request('audio.get', {'user_id' : [мой id vk]}, function(_o) {
console.log(_o);
});

If I understand correctly, you need to specify access_tokken (I already received it), but I don’t understand where and how to specify

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Burov, 2016-06-07
@BuriK666

Read the documentation, everything is written there:

/**
 * Request client methods
 */
// First you have to pass access_token from client side JS code
vk.setToken(access_token);

A
artjerom, 2016-06-07
@artjerom

Maybe I'm doing something wrong, I tried to change and get data about groups

var VK = require('vksdk');
var vk = new VK({
   'appId'     : [id приложение],
   'appSecret' : '[секретный ключ]'
});

vk.setToken([мой токен]);

vk.setSecureRequests(false);
vk.request('groups.get', {'user_id' : [мой id vk]}, function(_o) {
console.log(_o);
});

Outputs the following
{ error: 
   { error_code: 5,
     error_msg: 'User authorization failed: no access_token passed.',
     request_params: [ [Object], [Object], [Object], [Object], [Object] ] } }

I thought the reason was that I was trying to display data through the terminal (node ​​main.js). But I allowed access

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question