Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix: treat private/LAN IPs as localhost for OAuth redirect URI

diegosouzapw245345f37d0b
diff --git a/src/shared/components/OAuthModal.tsx b/src/shared/components/OAuthModal.tsx
index 8749b8a62f..5e06988aea 100644
--- a/src/shared/components/OAuthModal.tsx
+++ b/src/shared/components/OAuthModal.tsx
@@ -34,12 +34,19 @@ export default function OAuthModal({
const callbackProcessedRef = useRef(false);
const flowStartedRef = useRef(false);
- // Detect if running on localhost (client-side only)
+ // Detect if running on localhost or private/LAN IP (client-side only)
+ // Google OAuth rejects private IPs (192.168.x.x, 10.x.x.x, etc.) the same as localhost,
+ // requiring device_id/device_name. Treat them identically for redirect URI construction.
useEffect(() => {
if (typeof window !== "undefined") {
- setIsLocalhost(
- window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1"
- );
+ const hostname = window.location.hostname;
+ const isLocal =
+ hostname === "localhost" ||
+ hostname === "127.0.0.1" ||
+ hostname.startsWith("192.168.") ||
+ hostname.startsWith("10.") ||
+ /^172\.(1[6-9]|2\d|3[01])\./.test(hostname);
+ setIsLocalhost(isLocal);
setPlaceholderUrl(`${window.location.origin}/callback?code=...`);
}
}, []);