Skip to content

Fix OAuth flow redirection issue#31

Merged
timothedelion merged 2 commits intomainfrom
tdelion/-/oauth-flow-on-self-hosted
Oct 22, 2025
Merged

Fix OAuth flow redirection issue#31
timothedelion merged 2 commits intomainfrom
tdelion/-/oauth-flow-on-self-hosted

Conversation

@timothedelion
Copy link
Copy Markdown
Member

Changed the callback server binding from "localhost" to "127.0.0.1" in oauth.py:351.

Likelihood Assessment: Very High (85-90%)

Here's why this is very likely the root cause:

Evidence Supporting This Fix

  1. Exact same code pattern as working ggshield - ggshield explicitly uses "127.0.0.1" and works, gg-mcp used "localhost"
    and failed
  2. Symptoms match perfectly:
    - Authentication succeeds ✓
    - Scope acceptance succeeds ✓
    - Browser redirect happens (GitGuardian redirects to http://localhost:8000)
    - But callback never arrives at the server ✗
    - Server times out waiting ✗
  3. The IPv4/IPv6 ambiguity problem:
    - When binding to "localhost", Python might bind to:
    • IPv6 (::1) only on some systems
    • IPv4 (127.0.0.1) only on others
    • Both on others
      - When the browser redirects to http://localhost:8000, it might:
      • Try IPv6 first (modern browsers often prefer IPv6)
    • Try IPv4 first (older browsers or specific configurations)
      - If there's a mismatch, the connection fails silently
  4. Self-hosted environment factors:
    - Corporate networks often have specific IPv6 policies
    - Self-hosted servers may have different network configurations than SaaS
    - Firewalls/security policies might treat IPv4 and IPv6 differently

@timothedelion timothedelion self-assigned this Oct 22, 2025
@timothedelion timothedelion merged commit 632731f into main Oct 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants