Всем привет , использую библиотеку VK-IO. Делаю через неё авторизацию с помощью дополнения @vk-io/authorization . Мне не приходит код двухфакторной авторизации, не ошибок ничгео. Просто не приходит вот код:
const { CallbackService, ICallbackServiceTwoFactorPayload, CallbackServiceRetry } = require("vk-io");
const { DirectAuthorization, officialAppCredentials } = require("@vk-io/authorization");
const readline = require("readline");
const { config } = require("dotenv");
config();
const readLine = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const callbackService = new CallbackService();
callbackService.onTwoFactor((payload = ICallbackServiceTwoFactorPayload, retry = CallbackServiceRetry) => {
readLine.question("Enter VK code:", answer => {
retry(answer).then(console.log).catch(console.error);
});
});
const direct = new DirectAuthorization({
callbackService,
scope: 'all',
// Direct authorization is only available for official applications
...officialAppCredentials.android, // { clientId: string; clientSecret: string; }
// Or manually provide app credentials
// clientId: process.env.CLIENT_ID,
// clientSecret: process.env.CLIENT_SECRET,
login: '11111',
password:'111111'
});
async function run() {
const response = await direct.run();
console.log('Token:', response.token);
console.log('Expires:', response.expires);
console.log('Email:', response.email);
console.log('User ID:', response.userId);
}
run().catch(console.error);