Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ошибка при вызове AccountVerification.run() #540

Closed
fortune1dev opened this issue Apr 18, 2023 · 3 comments
Closed

Ошибка при вызове AccountVerification.run() #540

fortune1dev opened this issue Apr 18, 2023 · 3 comments

Comments

@fortune1dev
Copy link

В качестве параметра передаю строку из error.redirectUri при ApipError error.code === 17 (запрос на валидацию).

node_modules@vk-io\authorization\lib\index.js:242
if (action.startsWith('https://')) {
^
TypeError: Cannot read properties of undefined (reading 'startsWith')
at getFullURL (C:\Users\kivan\Source\repos\vkpromouter\node\node_modules@vk-io\authorization\lib\index.js:242:16)
at AccountVerification.processValidateForm (C:\Users\kivan\Source\repos\vkpromouter\node\node_modules@vk-io\authorization\lib\index.js:1234:21)
at AccountVerification.run (C:\Users\kivan\Source\repos\vkpromouter\node\node_modules@vk-io\authorization\lib\index.js:1139:39)

Не пойму, что я не так делаю. Или баг?

@fortune1dev
Copy link
Author

в @vk-io/authorization/lib/index.js
строка 1233, меняем
const href = $('#activation_wrap a').attr('href');
на
const href = $('form a').attr('href');

работает.

@negezor
Copy link
Owner

negezor commented Apr 18, 2023

Какой HTML селектор в самой форме для ссылки? Лучше если мы будем точно знать.

@fortune1dev
Copy link
Author

Какой HTML селектор в самой форме для ссылки? Лучше если мы будем точно знать.

Эм... я не совсем понял вопрос.
Вот же я указал в коде, как получаю рабочий селектор:
const href = $('form a').attr('href');
т.е. просто "form a", а у вас сейчас "#activation_wrap a". Видимо ВК поменяли HTML-код страницы валидации.
Да и вообще, там то URL похож на redirectUri из error.redirectUri. Можно просто замену одного параметра в урле делать и даже не парсить форму. Шанс на его замену ВК, возможно даже ниже, чем на смену HTML, как сейчас случилось. Но это не принципиально, возможно парсинг формы надежнее. Не берусь судить.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants