decolua/9router · error · Error
data.error || "Authentication failed"
Error message
data.error || "Authentication failed"
What it means
IFlowCookieModal's handleSubmit POSTs the pasted iFlow cookie to its backend endpoint and throws Error(data.error || 'Authentication failed') when the response is not ok, surfacing the server's reason (or the generic fallback) in the modal. It validates credentials by having the backend attempt an authenticated call against iFlow.
Source
Thrown at src/shared/components/IFlowCookieModal.js:36
if (!cookie.trim()) {
setError("Please paste your cookie");
return;
}
setLoading(true);
setError(null);
try {
const res = await fetch("/api/oauth/iflow/cookie", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ cookie: cookie.trim() }),
});
const data = await res.json();
if (!res.ok) {
throw new Error(data.error || "Authentication failed");
}
setSuccess(true);
setTimeout(() => {
onSuccess?.();
handleClose();
}, 1500);
} catch (err) {
setError(err.message);
} finally {
setLoading(false);
}
};
const handleClose = () => {
setCookie("");
setError(null);
setSuccess(false);View on GitHub (pinned to 90b52e06ff)
Solutions
- Re-copy the full cookie value from a fresh logged-in iFlow session (no truncation, no extra characters)
- Log in to iFlow again to obtain a new session cookie and retry immediately
- Check the backend route logs to see the real upstream rejection reason when the generic message shows
- Confirm the cookie belongs to the iFlow environment the router targets
Example fix
// before
throw new Error(data.error || "Authentication failed");
// after
throw new Error(data.error || `iFlow authentication failed (HTTP ${res.status})`); Defensive patterns
Strategy: try-catch
Validate before calling
const cookie = cookieInput.trim();
if (!cookie || cookie.length < 20) { setError("Paste a valid iFlow session cookie"); return; } Type guard
function looksLikeCookie(v) { return typeof v === "string" && v.trim().length > 0 && v.includes("="); } Try / catch
try {
const res = await fetch(iflowImportEndpoint, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ cookie }) });
const data = await res.json();
if (!res.ok) throw new Error(data.error || `Authentication failed (HTTP ${res.status})`);
setSuccess(true);
} catch (err) {
setError(err.message);
} Prevention
- Copy the entire cookie header value, not just one name=value pair
- Re-login to iFlow to get a fresh cookie before each import attempt
- Confirm the cookie matches the iFlow environment being targeted
- Watch for iFlow auth flow changes; keep the backend validator updated
When it happens
Trigger: Submitting an invalid/expired/rejected iFlow session cookie, an empty or malformed cookie string that the backend cannot parse, or the backend's upstream validation call failing with a non-2xx response lacking an `error` field.
Common situations: Cookie copied with surrounding text or truncated; iFlow session expired since copying; iFlow upstream unreachable or changed its auth flow; pasting a cookie for the wrong iFlow environment/account.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- Vertex partner models require a project_id. Add it in provid
- Vertex: failed to mint access token from Service Account JSO
- Vertex: failed to refresh access token from ADC JSON (author
- qoder PAT exchange failed: ${res.status} ${text.slice(0, 200
- No Codex access token available. Please re-authorize the con
AI-assisted analysis of decolua/9router@90b52e06ff (2026-08-30).
Data as JSON: /api/errors/97ae0aebb7c13ccf.
Report an issue: GitHub.