-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathcookies_store.js
40 lines (29 loc) · 1.45 KB
/
cookies_store.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const vrchat = require("vrchat");
const readline = require("readline")
import globalAxios from "axios"
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
const prompt = (query) => new Promise((resolve) => rl.question(query, resolve));
const configuration = new vrchat.Configuration({
username: "username",
password: "password",
baseOptions: {
headers: { "User-Agent": "ExampleProgram/0.0.1 [email protected]"}
}
});
const authenticationApi = new AuthenticationApi(configuration);
async function main() {
var currentUser = (await authenticationApi.getCurrentUser()).data
if (currentUser["requiresTwoFactorAuth"] && currentUser["requiresTwoFactorAuth"][0] === "emailOtp") {
await authenticationApi.verify2FAEmailCode({ code: await prompt("email Code\n") })
currentUser = (await authenticationApi.getCurrentUser()).data;
}
if (currentUser["requiresTwoFactorAuth"] && currentUser["requiresTwoFactorAuth"][0] === "totp") {
await authenticationApi.verify2FA({ code: await prompt("2fa Code\n") })
currentUser = (await authenticationApi.getCurrentUser()).data;
}
console.log(`Logged in as: ${currentUser.displayName}`);
const store = globalAxios.defaults.jar.store.idx["api.vrchat.cloud"]["/"];
console.log(`auth=${store["auth"]["value"]}`)
console.log(`twoFactorAuth=${store["twoFactorAuth"]["value"]}`)
}
main();