Skip to content
This repository has been archived by the owner on Aug 27, 2021. It is now read-only.

calmery/vrchat

Repository files navigation

vrchat

vrchat - npm Build And Lint Commitizen Friendly

Unofficial VRChat API Client 🤫

Installation

Notice: This npm package has been replaced by vrchatapi/vrchatapi-javascript since version 1.0.0.

$ npm i vrchat@0.2.0

Usage

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();