negezor / vk-io

Modern VK API SDK for Node.js
https://npm.im/vk-io
MIT License
549 stars 85 forks source link

Ошибка при авторизации ImplicitFlowUser #520

Open arman-oganesyan opened 2 years ago

arman-oganesyan commented 2 years ago

What did you do?

Через официальное приложение андроид авторизация Direct работает. Пытаюсь ImplicitFlow со своим приложением.

const options: auth.IImplicitFlowOptions = {
      callbackService: this._callbackService,
      scope: 'all',
      clientId: 'тут айди',
      clientSecret: 'тут защищенный ключ',
      login: 'тут имейл',
      password: 'тут пароль',
      apiVersion: '5.131'
};

const direct = new auth.ImplicitFlowUser(options);
direct.run()

What was the actual result?

AuthorizationError: Auth form error: Ein Serverfehler ist aufgetreten. Bitte versuchen Sie es später erneut.
    at ImplicitFlowUser.login (C:\Sources\gn\rjs\node_modules\@vk-io\authorization\lib\index.js:690:23)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ImplicitFlowUser.run (C:\Sources\gn\rjs\node_modules\@vk-io\authorization\lib\index.js:926:30)
    at async run (C:\Sources\gn\rjs\main.js:25:19) {
  code: 'AUTHORIZATION_FAILED',
  pageHtml: undefined,
  [cause]: undefined
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
   <head>
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <title>VK | Login</title>
      <link type="text/css" rel="stylesheet" href="https://vk.com/css/al/commonundefined.d5ec8b799fc65a71c064.css">
      <link type="text/css" rel="stylesheet" href="https://vk.com/css/al/baseundefined.10087db2dbccbf2d6d92.css">
      <link type="text/css" rel="stylesheet" href="https://vk.com/css/al/vkuiundefined.550cfb98b4cea8d84269.css">
      <link type="text/css" rel="stylesheet" href="https://vk.com/css/al/fonts_utfundefined.2546d253c69649b0561c.css">
      <link type="text/css" rel="stylesheet" href="https://vk.com/css/al/fonts_cntundefined.2ed2de7040c5dd011574.css">
      <link type="text/css" rel="stylesheet" href="https://vk.com/css/api/oauth_popupundefined.593ce0d6568d49594059.css">
      <script type="text/javascript" language="javascript" src="https://vk.com/js/api/common_light.js?2"></script>    <script type="text/javascript" language="javascript">// <![CDATA[      function allow(button) {        if (isButtonLocked(button)) return false;        lockButton(button);        var addr = '';        if (isChecked('allow_notifications')) {          addr = '&notify=1';        }        if (isChecked('denied_email')) {          addr += '&email_denied=1';        }        if (isChecked('denied_phone')) {          addr += '&phone_denied=1';        }        location.href = "https://login.vk.com/?act=grant_access&client_id=4436034&settings=140492191&response_type=token&group_ids=&token_type=0&v=&display=page&ip_h=57cfa92dc473a96b70&hash=1666945529_e06db5b1d765340338&https=1&state=&redirect_uri=https%3A%2F%2Foauth.vk.com%2Fblank.html"+addr;        return false;      }      function cancel() {        location.href = "https://login.vk.com/?act=grant_access&client_id=4436034&settings=140492191&response_type=token&group_ids=&token_type=0&v=&display=page&ip_h=57cfa92dc473a96b70&hash=1666945529_e06db5b1d765340338&https=1&state=&redirect_uri=https%3A%2F%2Foauth.vk.com%2Fblank.html&cancel=1";        return false;      }      function login(button) {        if (isButtonLocked(button)) return false;        lockButton(button);        document.querySelector('#login_submit').submit();      }      function doResize(onResize) {        onResize && setTimeout(function() {          doResize()        }, 100);        if (!hasClass(document.body, 'oauth_centered') && !onResize) {          if (window.outerHeight !== void 0) {            var panelH = (window.outerHeight - window.innerHeight) | 0,              panelW = (window.outerWidth - window.innerWidth) | 0;          } else {            var panelH = 50,              panelW = 0;          }          var contentH = Math.max(document.querySelector('#oauth_wrap_content').offsetHeight, 430),            contentW = 655;          window.resizeTo(contentW + panelW, contentH + panelH);          window.moveTo(            (screen.width - contentW) / 2 + (screen.availLeft | 0),            ((screen.height - contentH) / 2) + (screen.availTop | 0)          );        }      }      function toggleEmailPrivacy() {        checkbox('denied_email');        if (!isChecked('denied_email')) {          hide('denied_email');          show('allowed_email');        } else {          hide('allowed_email');          show('denied_email');        }      }      function togglePhonePrivacy() {        checkbox('denied_phone');        if (!isChecked('denied_phone')) {          hide('denied_phone');          show('allowed_phone');        } else {          hide('allowed_phone');          show('denied_phone');        }      }      if (parent && parent != window) {        location.href = "https://oauth.vk.com/blank.html";      }          // ]]></script>  
   </head>
   <body onload="doResize();" class="VK1 oauth_centered">
      <script>      if (window.devicePixelRatio >= 2) document.body.className += ' is_2x';    </script>    
      <div class="oauth_wrap">
         <div class="oauth_wrap_inner">
            <div class="oauth_wrap_content" id="oauth_wrap_content">
               <div class="oauth_head">
                  <a class="oauth_logo fl_l" href="https://vk.com" target="_blank"></a>  
                  <div id="oauth_head_info" class="oauth_head_info fl_r">  <a class="oauth_reg_link" href="https://vk.com/join?reg=1" target="_blank">Registrieren</a></div>
               </div>
               <div class="oauth_content box_body clear_fix">
                  <div class="box_msg_gray box_msg_padded">Sie müssen sich auf <b>VK</b> anmelden, um fortzufahren.</div>
                  <form method="POST" id="login_submit" action="https://login.vk.com/?act=login&amp;soft=1">
                     <div class="oauth_form">
                        <div class="box_error">Ein Serverfehler ist aufgetreten. Bitte versuchen Sie es später erneut.</div>
                        <div class="oauth_form_login">
                           <input type="hidden" name="ip_h" value="57cfa92dc473a96b70">        <input type="hidden" name="lg_domain_h" value="a41bc37942758bd093">        <input type="hidden" name="_origin" value="https://oauth.vk.com">        <input type="hidden" name="to" value="aHR0cHM6Ly9vYXV0aC52ay5jb20vYXV0aG9yaXplP2NsaWVudF9pZD00NDM2MDM0JnJlZGlyZWN0X3VyaT1odHRwcyUzQSUyRiUyRm9hdXRoLnZrLmNvbSUyRmJsYW5rLmh0bWwmcmVzcG9uc2VfdHlwZT10b2tlbiZzY29wZT0xNDA0OTIxOTEmdj0mc3RhdGU9JmRpc3BsYXk9cGFnZQ--">        <input type="hidden" id="expire" name="expire" value="0">        
                           <div class="oauth_form_header">Telefon oder E-Mail</div>
                           <input type="text" class="oauth_form_input dark" name="email" value="">        
                           <div class="oauth_form_header">Passwort:</div>
                           <input type="password" class="oauth_form_input dark" name="pass">                <button class="flat_button oauth_button button_wide" id="install_allow" type="submit" onclick="return login(this);">Anmelden</button>        <a class="oauth_forgot" href="https://vk.com/restore" target="_blank">Passwort vergessen?</a>        <input type="submit" name="submit_input" class="unshown">      
                        </div>
                     </div>
                  </form>
               </div>
            </div>
         </div>
      </div>
   </body>
</html>

Additional Info

Versions

package version
vk-io 4.7.0
@vk-io/authorization 1.3.0
node 16.17.1
TypeScript 4.8.4
npm or yarn 8.15.0
negezor commented 2 years ago

Учитывая сообщение, на стороне ВКонтакте произошла ошибка.

arman-oganesyan commented 1 year ago

@negezor ошибка до сих пор актуальна. И она не только у меня воспроизводится. Есть у вас какие-либо мысли на этот счет, в чем причина может быть? Может изменения на стороне ВК были сделаны, и необходимо в библиотеке доработку сделать из-за этих изменений?