code: function(cb, settings) {
          if (!VK._apiId) {
            return false;
          }
  
          var url = VK._domain.main + VK._path.login + '?client_id='+VK._apiId+'&display=popup&redirect_uri=close.html&response_type=token';
          if (settings && parseInt(settings, 10) > 0) {
            url += '&scope=' + settings;
          }
  
          VK.Observer.unsubscribe('auth.onLogin');
          VK.Observer.subscribe('auth.onLogin', cb);
  
          VK.UI.popup({
            width: 665,
            height: 370,
            url: url
          });
  
          var authCallback = function() {
            VK.Auth.getLoginStatus(function(resp) {
              VK.Observer.publish('auth.onLogin', resp);
              VK.Observer.unsubscribe('auth.onLogin');
            }, true);
          }
  
          VK.UI.popupOpened = true;
          var popupCheck = function() {
            if (!VK.UI.popupOpened) {
              return false;
            }
  
            try {
              if (!VK.UI.active.top || VK.UI.active.closed) {
                VK.UI.popupOpened = false;
                authCallback();
                return true;
              }
            } catch(e) {
              VK.UI.popupOpened = false;
              authCallback();
              return true;
            }
            setTimeout(popupCheck, 100);
          };
  
          setTimeout(popupCheck, 100);
        }
docs: Public VK.Auth methods