{ AuthError: Could not log in
at ImplicitFlowUser.run (file:///Users/andreisoroka/git/temp/node_modules/vk-io/lib/index.mjs:1704:17)
at processTicksAndRejections (internal/process/next_tick.js:81:5)
code: 'AUTHORIZATION_FAILED',
name: 'AuthError',
pageHtml: null }
vk-io
๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๊น?4.0.0-rc.15
11.11.0
๋จ์ ๊ถํ ๋ถ์ฌ
import VK from "vk-io";
export default function getToken({login, password}) {
const vk = new VK({
appId: process.env.VK_APP_ID,
login,
password,
});
return vk.auth.implicitFlowUser().run()
}
์ฝ๋์ ๋ค์ด๊ฐ์ ๋๋ฒ๊น
ํ ๊ฒฐ๊ณผ "์์ฉ ํ๋ก๊ทธ๋จ ์ก์ธ์ค๋ฅผ ํ์ฉํ์๊ฒ ์ต๋๊น? ์/์๋์" ํ์ด์ง์์ ์ถฉ๋์ด ๋ฐ์ํ๋ ๊ฒ์ ํ์ธํ์ต๋๋ค.
์ด์ ์ ์ฌ์ฉํ๋ ๋ฒ์ 4.0.0-rc.7๋ก ๋กค๋ฐฑํ๋๋ฐ ๋ชจ๋ ๊ฒ์ด ์ ๋๋ก ์๋ํ์ต๋๋ค. ๊ฒฐ๋ก : ์
๋ฐ์ดํธ์ ํจ๊ป ๋ฒ๊ทธ๊ฐ ๋ฐ์ํ์ต๋๋ค.
ํ ํฐ ๋ฐ๊ธฐ
์น์ธ ์ค๋ฅ
์ฌํ์ด ์ด๋ ค์ฐ์๋ฉด ์ ๊ฐ ๋์๋๋ฆฌ๊ฒ ์ต๋๋ค)))
๊ฐ๋จํ ๋ณ๊ฒฝ ์ฌํญ์ ์ดํด๋ณด์์ง๋ง ๊ถํ ๋ถ์ฌ์ ๊ด๋ จํ์ฌ ํน๋ณํ ๋ณ๊ฒฝ๋ ์ฌํญ์ ์๋ ๊ฒ ๊ฐ์ต๋๋ค. HTML ํ์ด์ง๋ฅผ ์ป์ ์ ์์ต๋๊น?
2019๋ 2์ 15์ผ ์ดํ์ ๋ฉ์ ์ ๊ฐ๋ฐ์ ์์ํ๋ ค๋ ๊ฒฝ์ฐ ์ง์์์ ํ ์คํธ ์ก์ธ์ค ๊ถํ์ ์ป์ด์ผ ํฉ๋๋ค. ์ด๋ ๋ ๋ฆฝ ์คํํ ์ ํ๋ฆฌ์ผ์ด์ ์ ๊ด๋ฆฌ์ ํค๋ก ๋ฉ์์ง ์น์ ์ ๋ฐฉ๋ฒ ์๋์ ์๋ฏธํฉ๋๋ค.
์ฌ์ฉ์ ์ง์ ๋ฉ์์ง API์ ๋ํ ์ ์ฒด ์ก์ธ์ค ๊ถํ์ ์ป์ผ๋ ค๋ฉด ์ ํ๋ฆฌ์ผ์ด์ ์ด ์กฐ์ ์ ํต๊ณผํด์ผ ํฉ๋๋ค.
์๋ฃจ์ ์ ์๋ฅผ ๋ค์ด Android ์ ํ๋ฆฌ์ผ์ด์ ์ ์ฌ์ฉํ๋ ๊ฒ์ผ ์ ์์ต๋๋ค.
async function loginVK() {
let login = await rl.questionAsync("Login: ");
console.log("Password: ");
rl.hideMode = true;
let password = await rl.questionAsync("");
rl.hideMode = false;
vk.setOptions({ login, password, });
const direct = vk.auth.androidApp();
vk.captchaHandler = async ({ src }, retry)=> {
let key = await rl.questionAsync("Enter captcha ["+src+"]: ");
try {
await retry(key);
console.log('Success');
} catch (e) { console.error(e); }
};
vk.twoFactorHandler = async (none, retry)=> {
let code = await rl.questionAsync("Enter twoFactor code: ");
try {
await retry(code);
console.log('Success');
} catch (e) { console.error(e); }
};
let res = false;
try {
res = await direct.run();
console.log(res);
} catch(e) { console.error(e); }
return res;
}
๋ํ ๋ก๊ทธ์ธ ์ค๋ฅ.
const script = $('script[type="text/javascript"][language="javascript"]').text();
๋ ๋น ๋ฌธ์์ด์ ๋ฐํํฉ๋๋ค. xs ์, html์ ์ ํ๊ธฐ์ ์ ํฉํ ํ๊ทธ๊ฐ ์์ต๋๋ค. ๋ ์์ ์ ์ํด ํซํฝ์ค๋ฅผ ๋ง๋ค์์ต๋๋ค.
const script = $('script[type="text/javascript"][language="javascript"]').text();
์ const script = $.html();
๋ก ๋์ฒด
์ฃ์กํฉ๋๋ค, ์ด์ ์์ผ ๋ดค์ต๋๋ค.
@spb-web ํ ๋ฆฌํ์คํธ ํ๊ธฐ ์ด๋ ต์ง ์๋์?
@negezor ๋๋ ๋ณด์๊ณ ์ด ๋ฌธ์ ์ ์์ธ์ด ๋ ๋ณ๊ฒฝ ์ฌํญ์ ํ์
ํ ์ ์์์ต๋๋ค.
๊ด๋ จ ๋๋กญ ํ์ด์ง? ์๋๋ฉด ๋์์ด ๊ด๋ฆฌ ํ์ต๋๊น?
@AndreiSoroka , ์ด๋ ต์ง ์๋ค๋ฉด ๋ฒ๋ฆฌ์ธ์)