Unofficial VRChat API Client 🤫
Notice: This npm package has been replaced by vrchatapi/vrchatapi-javascript since version 1.0.0.
$ npm i vrchat@0.2.0
import { VRChat, VRChatTFAMethod } from "vrchat";
const main = async () => {
const vrchat = new VRChat();
const tfa = await vrchat.login(
process.env.VRCHAT_USERNAME,
process.env.VRCHAT_PASSWORD
);
if (tfa && tfa.includes(VRChatTFAMethod.TimeBasedOneTimePassword)) {
await vrchat.verifyTfa(
VRChatTFAMethod.TimeBasedOneTimePassword,
process.env.VRCHAT_TFA_CODE
);
}
console.log(vrchat.auth);
console.log(vrchat.twoFactorAuth);
// await vrchat.get("...");
};
main();
import { VRChatTFAMethod, login, verifyTfa } from "vrchat";
const main = async () => {
let twoFactorAuth: string;
const { auth, tfa } = await login(
process.env.VRCHAT_USERNAME,
process.env.VRCHAT_PASSWORD
);
if (tfa && tfa.includes(VRChatTFAMethod.TimeBasedOneTimePassword)) {
const { twoFactorAuth: _twoFactorAuth } = await verifyTfa(
auth,
VRChatTFAMethod.TimeBasedOneTimePassword,
process.env.VRCHAT_TFA_CODE
);
twoFactorAuth = _twoFactorAuth;
}
console.log(auth);
console.log(twoFactorAuth);
// await vrchat.get("...");
};
main();