DNXLabs / DNXLabs/ssosync-action

Lov2

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
1
Forks
2
PR merge metrics
No merged PRs in 30d

Description

easyvk({
token: "{APP_TOKEN}"
}).then(vk => {
console.log(vk.session.app_id);
})
{

app_id: 0,
app_title: '',
app_type: '',
app_icons: ['', ''],
author: {
id: 0
},
app_members: 0,
client_id: parseInt('233_ID_приложения', 10)
}
Copy
Двухфакторная авторизация
В EasyVK есть поддержка двухфакторной авторизации. Для того, чтобы ее пройти, необходимо сначала получить код приложения из SMS или из приложения-верификтора, а затем передать его в параметр code при авторизации пользователя.

[ - ] (Спойлер) - Пример кода для двухфакторной авторизации пользователя
const easyvk = require("easyvk");
const readline = require('readline');

const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});

async function main (vk) {
// главный код вашего приложения
console.log(vk.session);
}

async function logInWith2Auth (params) {
return new Promise((_2faNeed) => {

function relogIn (_2faCode = "") {

if (_2faCode) params.code = _2faCode

easyvk(params).then(main).catch((err) => {

if (!err.easyvk_error) {
if (err.error_code == "need_validation") {
_2faNeed({
err: err,
relogIn: relogIn
});
}

}

})
}

relogIn()

})
}

logInWith2Auth({
username: "Логин",
password: "Пароль",
reauth: true,
}).then(({err: error, relogIn}) => {

console.log(error.validation_type);

rl.question(error.error + " ", (answer) => {

let code = answer;
relogIn(code);

rl.close();

});

})

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.