pve-client
    Preparing search index...

    Type Alias ClientOptions

    ClientOptions: (
        | { apiToken: string }
        | {
            password: string;
            realm?: string;
            tfa?: (
                challenge: TfaChallenge,
            ) => Promise<string | undefined> | string | undefined;
            username: string;
        }
        | { session: PveSession }
    ) & { agent?: Agent; apiPath?: string; baseUrl: string; fetch?: FetchLike }

    Type Declaration

    • { apiToken: string }
      • apiToken: string

        API token string, either full "PVEAPIToken=user@realm!token=secret" or shorthand "user@realm!token=secret"

    • {
          password: string;
          realm?: string;
          tfa?: (
              challenge: TfaChallenge,
          ) => Promise<string | undefined> | string | undefined;
          username: string;
      }
      • password: string
      • Optionalrealm?: string

        Defaults to "pam"

      • Optionaltfa?: (challenge: TfaChallenge) => Promise<string | undefined> | string | undefined

        Called when the account needs a second factor. Return the code the user entered: 6-8 digits is sent as TOTP, anything else as a recovery key; a totp:/recovery:/yubico:/webauthn: prefix is passed through. Without it, a 2FA account fails with a clear error.

      • username: string
    • { session: PveSession }
      • session: PveSession

        An existing ticket session, e.g. restored from storage or obtained through OpenID login (api.access.openid.login). There is no password: when it nears expiry or Proxmox answers 401 the ticket is renewed with itself. If renewal fails, the request fails.