Skip to content

fix(auth): Register auth router and fix GitHub OAuth flow (#821)#1012

Open
yw13931835525-cyber wants to merge 1 commit intoSolFoundry:mainfrom
yw13931835525-cyber:main
Open

fix(auth): Register auth router and fix GitHub OAuth flow (#821)#1012
yw13931835525-cyber wants to merge 1 commit intoSolFoundry:mainfrom
yw13931835525-cyber:main

Conversation

@yw13931835525-cyber
Copy link
Copy Markdown

Fixes Bounty #821 - GitHub OAuth Sign-In Flow

Issues Fixed:

  1. Auth router not registered (main.py) - All auth endpoints were returning 404 because the auth router was never included in the app.

  2. Missing Pydantic models (models/user.py) - Added missing request/response models:

    • GitHubOAuthRequest, GitHubOAuthResponse
    • WalletAuthRequest, WalletAuthResponse
    • LinkWalletRequest, LinkWalletResponse
    • RefreshTokenRequest, RefreshTokenResponse
    • AuthMessageResponse
  3. Wrong callback endpoint method (api/auth.py) - Changed from POST /github to GET /github/callback. GitHub OAuth redirects users back with a GET request, not POST.

  4. URL encoding issue (services/auth_service.py) - Used urlencode() for query parameters to properly encode special characters in redirect_uri and other params.

Verification:

  • ✅ Syntax validated
  • ✅ All 4 files modified
  • ✅ Backward compatible with existing wallet auth

Reward:

Fixes for Bounty SolFoundry#821 - GitHub OAuth Sign-In Flow:

1. main.py: Add missing auth_router registration
   - Auth endpoints were returning 404 because router wasn't registered

2. models/user.py: Add missing Pydantic request/response models
   - GitHubOAuthRequest, GitHubOAuthResponse
   - WalletAuthRequest, WalletAuthResponse
   - LinkWalletRequest, LinkWalletResponse
   - RefreshTokenRequest, RefreshTokenResponse
   - AuthMessageResponse

3. api/auth.py: Fix callback endpoint
   - Change from POST /github to GET /github/callback
   - GitHub OAuth redirects with GET, not POST
   - Accept code and state as query parameters

4. services/auth_service.py: Fix URL encoding
   - Use urlencode() for query parameters
   - Ensures redirect_uri and other params are properly encoded

Fixes T1 bounty - unlocks T2/T3 eligibility (200K FNDRY)
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