Skip to content

Commit f4a94d2

Browse files
committed
fix: support email otp
1 parent de094f8 commit f4a94d2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/client.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export interface VRChatOptions extends Omit<NonNullable<Parameters<typeof create
5555
credentials?: Lazy<LoginCredentials>;
5656
/**
5757
* If set to `true`, the client will attempt to authenticate immediately after being created.
58-
* If set to `false` or not provided, the client will only re-authenticate on request failure (e.g. 401 Unauthorized).
58+
* If set to `false`, the client will only re-authenticate on request failure (e.g. 401 Unauthorized).
5959
* @default true
6060
*/
6161
optimistic?: boolean;
@@ -79,7 +79,9 @@ export interface LoginCredentials {
7979
*/
8080
password: string;
8181
/**
82-
* The secret key for two-factor authentication.
82+
* The secret key for two-factor authentication, useful for service accounts & automated workflows.
83+
* If this is a user-initiated login, don't use this.
84+
*
8385
* Equivalent to ``twoFactorCode: TOTP.generate(totpSecret).otp``.
8486
*/
8587
totpSecret?: string;
@@ -370,8 +372,8 @@ export class VRChat extends VRChatInternal {
370372

371373
const factors = await Promise.all([
372374
twoFactorMethods.includes("totp") ? this.verify2Fa.bind(this) : undefined,
373-
// this.verify2FaEmailCode.bind(this),
374-
// this.verifyRecoveryCode.bind(this)
375+
twoFactorMethods.includes("otp") ? this.verify2FaEmailCode.bind(this) : undefined,
376+
twoFactorMethods.includes("otp") ? this.verifyRecoveryCode.bind(this) : undefined
375377
].filter(Boolean).map((function_) => function_?.({
376378
...options,
377379
throwOnError: false,

0 commit comments

Comments
 (0)