A
A
Alexey Petrov2017-01-29 22:42:24
In contact with
Alexey Petrov, 2017-01-29 22:42:24

Why can the photos.getAlbums method return {error: {error_code: 15, error_msg: "Access denied"}}?

Hello.
I just started to understand the javascript SDK. I'm trying to use the photos.getAlbums method.
I make the request like this:

VK.init({
    apiId: *******,
    scope: 4
  });
var app = {
  auth: {}	// authorization result
}
  VK.Auth.login(function(response) {
    $.each(response, function (index, value) {
      app.auth[index] = value;
    });
  });
  VK.Api.call('photos.getAlbums', {owner_id: this.auth.session.user.id
    function(r) {
      alert(r);
    });

As a result, in r I have an error - "Access denied". Where is the mistake?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Petrov, 2017-01-31
@Oegir

The permission mask must be specified not in VK.init, but as the second parameter of VK.Auth.login like this:

VK.Auth.login(function(response) {
    // ...
}, 4);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question