y as a cookie with path=/
          document.cookie = `nyaproxy_api_key=${apiKey}; path=/; max-age=7200; SameSite=Strict`;

          // Redirect back to the original path
          window.location.href = "{{ return_path }}";
        } catch (error) {
          document.getElementById("errorText").textContent = "Error during authentication. Please try again.";
          errorElem.style.display = "flex";

          // Reset button state
          submitButton.classList.remove("loading");
          submitButt