rozod
    Preparing search index...

    Function refreshCookie

    • Param Returns Example

      Proactively refreshes a cookie session using Roblox's session refresh endpoint. This creates a new session and invalidates the old one, returning the new cookie.

      Use this to manually trigger cookie rotation before the automatic rotation kicks in, or to refresh cookies on a schedule to ensure they don't expire.

      This function uses the library's internal fetch mechanism, which includes:

      • Automatic CSRF token handling
      • Hardware-backed authentication (HBA) signatures
      • Generic challenge handling (if configured)

      cookieIndex - Index in the cookie pool to refresh (default: 0). Ignored if using single cookie. Result object with success status and new cookie value if successful

      // Refresh the default/first cookie
      const result = await refreshCookie();
      if (result.success) {
      console.log('New cookie:', result.newCookie);
      // Persist the new cookie to your storage
      await db.updateCookie(result.poolIndex, result.newCookie);
      }

      // Refresh a specific cookie in the pool
      const result = await refreshCookie(2); // Refresh third account

      // Refresh all cookies in a pool
      const cookies = getCookies();
      for (let i = 0; i < cookies.length; i++) {
      const result = await refreshCookie(i);
      if (result.success) {
      await db.updateCookie(i, result.newCookie);
      }
      }

      Parameters

      • cookieIndex: number = 0

      Returns Promise<RefreshCookieResult>